|
|
On 10/3/22 01:22 Greg Ercolano wrote:
On 10/2/22 15:01, Gonzalo Garramuno wrote:
I have used Fl_Pack in the past and I always
struggle with its behavior.
Fl_Pack has some "very special" properties and should only be used
if it's exactly what you need. See also Greg's replies in this
thread.
IMHO it is often be easier to implement specialized resizing
behavior like yours in your own container widget derived from
Fl_Group using the resize() method, particularly if you can control
addition/removal or hiding/showing of child widgets.
[Greg's reply mostly stripped]
You might be able to use Albrecht's new Fl_Flex widget
(new in 1.4.x) for this,
I'm not sure. He can probably advise.
Yes, probably. I didn't try Gonzalo's demo program though. But
Gonzalo's statement "I would like the Fl_Gl_Window widget to stretch
and fill the Fl_Pack whenever the Fl_Group is hidden when the Hide
button is clicked" sounds like a good reason to use Fl_Flex.
Anyway, some facts:
As Greg wrote, the Fl_Pack widget "shrink-wraps" around its children
and uses a special handling of the resizable() child widget. It
applies these special features mostly inside the draw() method which
makes its behavior even less predictable (and IMHO usable).
Fl_Flex is designed to be used as a drop-in replacement of Fl_Pack
(if you don't use some special Fl_Pack properties and methods). It's
mostly source compatible and you can try/view/test this in
test/pack.cxx which has been modified to use either an Fl_Pack or an
Fl_Flex container inside an Fl_Scroll widget or as a main container.
Fl_Flex's resize behavior is kinda the opposite of Fl_Pack. Fl_Flex
uses all the space assigned to it (w, h) and resizes its children to
fit according to some rules. If you hide one child widget (of a
total of two children) the other one will take the entire space of
the parent Fl_Flex container. But beware: Fl_Flex is already
functional but not yet 100% complete.
That said, another container (Fl_Grid) is work in progress and will
provide a grid (aka matrix) of widgets similar to an HTML
<table>. Fl_Grid will be included in 1.4.0 if nothing really
bad happens, I'm pretty confident. Fl_Grid may not be what you want
though but you can construct an Fl_Grid widget with only one row or
one column if you want its particular resizing features which are
much more versatile than Fl_Flex.
Fl_Flex and Fl_Grid can be children of another Fl_Group (or derived,
even Fl_Flex or Fl_Grid) widget, hence you can achieve complex
nested resizing behavior.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/312b0261-7325-c02e-9839-6c58b583fad9%40online.de.
[ Direct Link to Message ] | |
|
| |