FLTK "Panel"

61 views
Skip to first unread message

Kenneth S.

unread,
Nov 23, 2023, 12:36:13 PM11/23/23
to fltk.general
Hi,

I was wondering if FLTK has something like a Windows "Panel" widget.

I'd like something that is a visible box and have other controls inside that but make sure that nothing is rendered beyond the box.

Would FL_Group work for that?

-Kenneth

Albrecht Schlosser

unread,
Nov 23, 2023, 12:46:39 PM11/23/23
to fltkg...@googlegroups.com
Yes, Fl_Group would work for this. You should make sure that all contained widgets (children) do not overlap the Fl_Group boundaries anyway (that would "make sure that nothing is rendered beyond the box") but if this is not feasible for some reason Fl_Group provides the clip_children() method which does exactly that even if children would cross group boundaries.
https://www.fltk.org/doc-1.4/classFl__Group.html#ac833b51b3a078bd20f6c9ee9494e31fd

However, there are many more layout or container widgets that may be easier to use for such a scenario, maybe Fl_Scroll, Fl_Grid, or Fl_Flex. There's a full chapter about "Layout and Container Widgets": https://www.fltk.org/doc-1.4/coordinates.html#coordinate_layout .

There are also many test and demo programs in the test and examples folders of the FLTK sources. These could be worth a look.

Kenneth S.

unread,
Nov 23, 2023, 1:23:29 PM11/23/23
to fltk.general
Thank you. I'll look at those.

I notice you linked to FLTK 1.4. I've been using the stable 1.3 branch. Do you recommend using 1.4?

Albrecht Schlosser

unread,
Nov 23, 2023, 1:45:31 PM11/23/23
to fltkg...@googlegroups.com
On 11/23/23 19:17 Kenneth S. wrote:
> Thank you. I'll look at those.

Welcome.

> I notice you linked to FLTK 1.4. I've been using the stable 1.3
> branch. Do you recommend using 1.4?

If you are currently developing a new application I recommend to use 1.4
because it's a lot better (more advanced) than 1.3 is. Highlights are
display scaling (all platforms) and Wayland (Linux, BSD only). FLTK
1.4.0 will also be released soon. Schedule is to release 1.4.0 - or at
least some release candidates - in December 2023.

The only drawback would be that you need to build it yourself and no
Linux distro will have it installed (or as a package) yet. It will take
some time until the Linux distros pick it up and provide it in their
(stable) distros.

That said, FLTK 1.4 is API compatible with FLTK 1.3 (as long as you
don't use methods and functions introduced in 1.4) and you can build
your app for both 1.3 and 1.4 on the same system.

imm

unread,
Nov 23, 2023, 4:10:38 PM11/23/23
to General FLTK
If it's a free floating panel, like a splash screen say, then use Fl_Window but call clear_border() on it before you show it.

If it's a panel within another window, then yes use Fl_Group.

--
Ian
From my Fairphone FP3

Reply all
Reply to author
Forward
0 new messages