On 7 Oct 2011, at 20:00, Marko wrote:

> I created a class that inherits from Fltk_Window to create a custom dialog.  
> Then I create the main application window which has an instance of that 
> custom input dialog.

I'm assuming your custom dialog is in a separate window of its own - if it is 
embedded within your main window then you ought to derive it from Fl_Group 
instead.

> 
> The trouble is when the custom input dialog window is on the screen and I 
> close the main application window the input dialog remains open.

Yup - if you put it in a separate window, that's what'll happen. You want to 
call hide() on that window when the main window closes.

> The correct behaviour should be that when the main application window is 
> closed any open subwindows should just close also.

Sure - so call hide() on all the open windows (or indeed all the windows!) when 
the main win closes and all will be well.

> By the way the custom dialog window is opened by calling the callback from an 
> Fltk_Menu instance on the main window.
> 
> When I click the close button on the main window I tried deleting the input 
> dialog window in the main window destructor, but I notice that clicking the 
> close button on the main window does not call that windows destructor.

What you want to do is write a callback that performs all the actions you want 
to perform when the main window closes, such as hiding any subsidiary windows, 
etc., and then attach that to the main window's callback.
Then when the main window is closed, the callback will be run and any 
appropriate actions (such as hiding your dialog box) will be triggered.

There's some notes on this in the docs actually, so you'll find more detail in 
there.





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

Reply via email to