Re: Why doesn't FLTK provide access to a widget Tree?
Webb Hinton
Jun 10, 2021
> I think your intuition about how fltk works may be missing the mark, that’s not really how it is done at all.
Understood, coming from a Web Dev environment, and given the various parent() and child() functions available to our FL::Group widgets, I assumed that behind the scenes some sort of tree structure was managing these relationships. If this is not how it works, then what kind of system FLTK use to keep track of parent/child relationships?
On Thursday, June 10, 2021 at 4:19:42 PM UTC-4 pvr...@btinternet.com wrote:
Hi Webb,
The F and L refer to Fast and Light. So stuff like you are asking for is an overhead most users might not want. It should be easy enough for you to implement that if you want.
Just wondering, why doesn't FLTK provide access to a global widget tree? Behind the scenes, does FLTK not use a tree like structure to represent the relationship between widgets, in a fashion similar to HTML?
A simple widget tree for an FLTK app might look like:
________________________________
Window
/ \
Group Group
/\ \
Button Button Button
________________________________
Wouldn't it be great to have access to the FL_Tree functions like root(), insert_above(), set_root(), prev(), next(), etc for all of our widgets?
For example, what if we wanted to make a Photoshop-style layer panel, a UI feature well suited to represent widgets in a tree data structure:
Container
/ \
Layer Group
/ \
Layer Layer
As things stand, we have to wrap widgets inside of a custom tree structure that we provide. But if behind the scenes FLTK already has some kind of tree like representation of widgets, why not let users leverage this?
Comments are owned by the poster. All other content is copyright 1998-2025 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.