FLTK logo

Re: [fltk.general] Why doesn't FLTK provide access to a widget Tree?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Why doesn't FLTK provide access to a widget Tree? Bill Spitzak Jun 11, 2021  
 
FLTK certainly uses a list of children and parent pointers just like any other tree representation. As stated above this system puts the "roots" at the level of the outermose Fl_Window objects.

It also knows about all the currently-shown windows in an internal list, I don't remember if that list is available, and there was some work done on making whether a window that was hidden or removed being in this list system-dependent. A window you create and then do nothing with will not be part of any internal tree, it will be it's own independent tree.


On Thu, Jun 10, 2021 at 2:17 PM Albrecht Schlosser <AlbrechtS.fltk@online.de> wrote:
On 6/10/21 10:54 PM Webb Hinton wrote:
> I think your intuition about how fltk works may be missing the mark, that’s not really how it is done at all.

Not really ... exactly ... but very similar, isn't it? At least for single windows.

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?

There's not one complete tree structure, but for each Fl_Group (derived) widget there is an array of children, and a Fl_Group widget may have a parent() with an Fl_Window as the top-most parent. However, ...

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.

That's true, it is basically all there and ...

On 10 Jun 2021 20:10, Webb Hinton <caroli...@gmail.com> wrote:
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:

That tree is not for a complete FLTK app, but for a single Fl_Window, yes.

________________________________
        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?

As Ian wrote, there's no "master" tree, widgets are independent and can be moved around and there can be lots of independent (or dependent) windows coming and going (like menu windows) etc..

PS: please don't top-post, it's hard to comment several different replies in this order.
https://en.wikipedia.org/wiki/Posting_style#Top-posting

--
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/7a8032db-2f7e-ccdb-d8f0-e9e1630d558b%40online.de.

--
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/CAL-8oAjc%2BEUqCVZugUQvjEwkHEDX7Zsgz2COjD1bWub1FkyjoA%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.