Accessing private Fl_Group::array_ and Fl_Group::child1_.

4 views
Skip to first unread message

melcher....@googlemail.com

unread,
Oct 30, 2022, 8:58:17 AM10/30/22
to fltk.coredev
Albrecht Schlosser schrieb am Donnerstag, 27. Oktober 2022 um 23:38:03 UTC+2:
On 10/27/22 21:05 'melcher....@googlemail.com' via fltk.coredev wrote:

OK, we're drifting even more OT, but yes: that's something I would really like to remove. It's IMHO useless anyway since a group is something that should hold more than one child in most cases. The special case 1 (child) is an intermediate status, not something we need to save memory. (...)

The array_/child1_ union is annoying, but the code works now, so I would not change it until we allow stl::vector. What bothers me is Fl_Group::array() giving write access to those private variables which Is then used by Fl_Scroll to keep the horizontal and vertical scroll bar at the end of the children list.

Fl_Table uses Fl_Scroll to manage table entries that happen to be widgets. It implements its own child() and children() methods, basically just forwarding calls to the Fl_Scroll inside. If children are not widgets, Fl_Table does its own thing altogether.

My point was that Fl_Group::array() should not exist at all. Or at least be limited to return a const pointer. Without breaking existing code, we should at least warn in the docs not to use array(), and deprecate it.

This loosely is related to virtual Fl_Group::insert and remove
Reply all
Reply to author
Forward
0 new messages