Re: Why doesn't FLTK provide access to a widget Tree?
"'Matthias Melcher' via fltk.general"
Jun 27, 2021
Fl::first_window() returns the topmost visible window in the app. Fl::next_window(Fl_Wndow*) will return the next visible window that is below the givin window. Calling show() on a window will add it to the list. If hide() is called, the window is removed again. After that, you can walk the tree using the child()/children() methods on all widgets that return non-null for as_group() . In the end, that just is your tree structure. The Fl_Tree widget uses a different setup internally to make life easier for text-only children, but in the end, yes, the UI is just a tree. Other notable API exceptions are Fl_Menu_Item (a list that acts as a tree, for historic reasons), and Fl_Table for the same reasons as Fl_Tree.
This is always available from within the app. Making the data available to the outside would be a huge security risk(*), but nothing keeps you from having a script interface within your app and give external apps access.
(*) imagine external apps changing the UI so that a dialog "Overwrite this file: yes, no" simply flips the "yes, no" labels, but keeps functionality the same - woopsie ;-)
janezz55 schrieb am Samstag, 26. Juni 2021 um 02:04:39 UTC+2:
Get the root node with top_window() and then follow the hierarchy from there with children(), child() and as_group().
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'.