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? "'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().

--
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/c9ccbf13-7e58-4f9c-9ee6-a2359903df9en%40googlegroups.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'.