|
|
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: https://www.fltk.org/str.php?L2639
Version: 1.4-feature
Regarding comment #9 - the issue with Fl_Group resizing (gr_rsz.cc):
Fl_Group resizes hidden widgets as well. This is correct because you can
for instance switch widgets in the same place like in Fl_Tabs where always
only one group is shown and all other groups (children) are hidden.
When your program hides g2 and resizes g3 to occupy its space, then g2 is
hidden "behind" the area of g3 which is the resizable. Hence g2 is resized
when the window is maximized. When you then show g2 and resize g3 by the
*current* height of g2, then you see the *resized* height of g2. This is
technically correct and as designed.
To fix this in your application (i.e. in the demo program) you can for
instance resize g2 to zero height after hiding it. Then it is not in the
range of the resizable and not resized when the window is maximized.
However, its "original" size is lost (now zero). Hence you need to use the
"known" original height of g2 to restore it before "freeing" the space by
resizing g3 (using g2->h()). OTOH you could use the constant, known height
of g2 (30) in both resizing operations.
Note also that init_sizes() is *required* after you rearrange children
within an Fl_Group widget: I removed obsolete statements and used
init_sizes() where appropriate.
Please see my working solution
https://www.fltk.org/strfiles/2639/str2639_rsz_gr.cxx for the Fl_Group
resizing issue mentioned in comment #9.
Long story, short: you need to *know* the original height of g2 to restore
it after resizing, this can't be avoided. At least this is what Fl_Group
provides with its proportional resizing algorithm. You may write your own
group widget that stores the initial width/height of some or all of its
children if you need to do such things.
Sounds complicated? Yes, some knowledge of the intrinsics of resizing is
required to know what's going on and why it does what it does.
Too complicated? There's Fl_Flex (since 1.4.0) that can help with a much
shorter program without knowing all that and without manually resizing
widgets.
Summary: Fl_Group resizing works as designed.
Link: https://www.fltk.org/str.php?L2639
Version: 1.4-feature
[ Direct Link to Message ] | |
|
| |