> What is the method to destroy any windows called open by the 
> main window, if the main window is closed? I realised i might 
> need this when i had a new window open that has limited 
> controls, i closed the main program window behind it and saw 
> that the second window remained open, 'high and dry' as the 
> user would not be able to do anything further and would have 
> to just x it out or ESC.

Note that, strictly speaking, you don't have to call the destructors on
the windows at all - simply calling hide() on them is enough.

Though I acknowledge your problem - you close your main window, but it
does not take its "helper" windows with it when it goes, leaving them up
and meaning that your app does not expire...

So, there are a few things you can try:

The "dirty" hack I usually use is to make all the pointers for the
top-level windows global, and then I attach a callback to the main
window (that is called when the window is closed.)

This callback walks through the list of child windows, and for any that
are non-zero (i.e. have been created and  shown at some point) I call
hide() on them.
Thus, when the main window goes, it takes its helpers with it.

An alternate approach is to use the main window callback again, but this
time have it use Fl::first_window() and Fl::next_window(...) in a loop
to find and each window the app has open, and then hide() each of these
in turn.
Again, I think this will do what you want.

Any good?



SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to