Interesting - I have a meeting to run to,
but I tweaked your code a bit (attached here) so that clicking
the first button invokes a callback that shows the xywh of the
inner packs and the check buttons, as the behavior seems like
some of the children are being moved outside the group, making
them unclickable. This may help folks trying to figure out what
the problem is - I'd do it but have time constraints today.
I think it's a bug in fltk's handling of Fl_Pack inside
Fl_Pack - haven't looked, but the xywh values of the
"unclickable" checkboxes (after a scroll down then back up)
seems suspicious, and the scroll/pack mechanisms are supposed to
be handling adjusting those properly. Might be a problem with a
pack-in-a-pack, and how the inner pack deals with being moved
around by the outer pack being moved around by the scroll
(woo!).
I'm thinking this should probably be reported as a bug.
On 6/20/25 08:03, Greg Ercolano wrote:
[..] the xywh values of the "unclickable" checkboxes (after a scroll down then back up) seems suspicious [..]
0000:
point_pack(xywh)=30,80,150,30
check_but(xywh)=30,80,150,30
0001:
point_pack(xywh)=30,110,150,30
check_but(xywh)=30,110,150,30
0002:
point_pack(xywh)=30,140,450,30
check_but(xywh)=30,106,150,30 <-- 106? should be 140
0003:
point_pack(xywh)=30,170,450,30
check_but(xywh)=30,102,150,30 <-- 102? should be 170
0004:
point_pack(xywh)=30,200,450,30
check_but(xywh)=30,101,150,30 <-- 101? should be 200
0005:
point_pack(xywh)=30,230,450,30
check_but(xywh)=30,100,150,30 <-- 100? should be 230
0006:
point_pack(xywh)=30,260,450,30
check_but(xywh)=30,96,150,30 <-- 96? should be 260
[..]
On 6/20/25 08:03, Greg Ercolano wrote:
[..] the xywh values of the "unclickable" checkboxes (after a scroll down then back up) seems suspicious [..]
- Note
- You can nest Fl_Pack widgets or put them inside Fl_Scroll widgets or inside other group widgets but their behavior can sometimes be "surprising". This is partly due to the fact that Fl_Pack widgets resize themselves during their draw() operation, trying to react on their child widgets resizing themselves during their draw() operations which can be confusing. If you want to achieve special resize behavior of nested group widgets it can sometimes be easier to derive your own specialized group widget than to try to make nested Fl_Pack widgets behave as expected.
On 6/20/25 08:03, Greg Ercolano wrote:
[..] the xywh values of the "unclickable" checkboxes (after a scroll down then back up) seems suspicious [..]
Hmm, this /might/ be "documented misbehavior"; according to the Fl_Pack docs, nesting Fl_Pack might behave weirdly.
Quoting the special note in the docs:
- Note
- You can nest Fl_Pack widgets or put them inside Fl_Scroll widgets or inside other group widgets but their behavior can sometimes be "surprising". This is partly due to the fact that Fl_Pack widgets resize themselves during their draw() operation, trying to react on their child widgets resizing themselves during their draw() operations which can be confusing. If you want to achieve special resize behavior of nested group widgets it can sometimes be easier to derive your own specialized group widget than to try to make nested Fl_Pack widgets behave as expected.
[ 0] Window (0x56510b0b9330) [ 0, 0,289,427] -tt- Window [ 0] Widget (0x56510b0a54f0) [ 8, 6, 15, 62] -tt- Debug [ 1] Group (0x56510b0bd610) [ 16, 47,231,388] -tt- Scroll [ 0] Group (0x56510b0bd890) [ 26, 47,600,450] -tt- NULL [ 0] Group (0x56510b0bd980) [ 26, 47, 30,160] -tt- NULL [ 0] Widget (0x56510b0a1eb0) [ 26, 47, 30, 80] -tt- Point 1 [ 1] Widget (0x56510b0a5190) [106, 47, 30, 80] -tt- abc [ 1] Group (0x56510b0bda40) [ 26, 77, 30,160] -tt- NULL [ 0] Widget (0x56510b0a1a80) [ 26, 77, 30, 80] -tt- Point 2 [ 1] Widget (0x56510b0a3280) [106, 77, 30, 80] -tt- abc [ 2] Group (0x56510b0bdb40) [ 26,107, 30,450] -tt- NULL [ 0] Widget (0x56510b0a18e0) [ 26, 48, 30, 80] -tt- Point 3 [ 1] Widget (0x56510b0a3200) [106, 48, 30, 80] -tt- abc ...```
It's possible replacing Fl_Pack with one of Albrecht's newer widgets (Fl_Flex, Fl_Grid) might be better than Fl_Pack. (I know Fl_Pack often gives people trouble)
0000: point_pack(xywh)=30,-52,450,28 check_but(xywh)=30,-52,450,28 0001: point_pack(xywh)=30,-24,450,28 check_but(xywh)=30,-24,450,28 0002: point_pack(xywh)=30,4,450,28 check_but(xywh)=30,4,450,28 0003: point_pack(xywh)=30,32,450,28 check_but(xywh)=30,32,450,28 0004: point_pack(xywh)=30,60,450,28 check_but(xywh)=30,60,450,28 ...```
In a first attempt I used Greg's latest demo program (foo2.cxx) and globally replaced Fl_Pack with Fl_Flex, and that was it. I made a few adjustments of sizes and added the callback that outputs widget sizes to *all* check buttons rather than only the first (so we can also click on "Point 20" if scrolled all the way down).