On 3 May 2012, at 20:40, dirac wrote:
> Hi guys,
> let's say I have a window with a button in it. The button, if clicked,
> creates a sub window:
>
> ---
> void button_callback(...) {
> new Fl_Window(...);
> }
> ---
>
> When I close the 'master' window (the one which contains the button) I would
> like to delete all the other subwindows. Is there a way to do it without
> keeping a pointer to all the child windows?
>
> Many thanks in advance!
The answer is probably yes, but what you have to do depends on what you mean by
"sub window":
- if you mean a window actually embedded in another "main" window as a child
widget of the "main" window then the "main" window will act as a container and
deleting the "main" window will traverse the list of children and destroy them
all too, automatically. So no other action is required by you.
- if you mean another separate window, then note that fltk already keeps a list
of all the active windows, and you can traverse that list by using
Fl::first_window() and hiding each window that it returns, until it comes up
null.
However, that will find and close *all* the windows in your app - if you only
want to close a specific subset, you might be best to maintain you own list
after all...
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk