MacArthur, Ian (SELEX GALILEO, UK) wrote:
>
>> For me this doesn't work, my application crash and this
>> solution doesn't
>> call the destructor of the windows and that can lead to undesirable
>> consequences.
>>
>> ------
>> void on_close(){
>> for(Fl_Window *flw = Fl::first_window(); flw; flw =
>> Fl::next_window(flw)){
>> if(flw) flw->hide();
>> }
>> //hide();
>> //Fl::delete_widget (this);
>> }
>> ----
>
> You got to watch the order in which things are updated and so forth in
> your loop - for me this works better:
>
> ----------------->%---------------------------------
>
> #include<FL/Fl.H>
> #include<FL/Fl_Double_Window.H>
>
> static void cb_close(Fl_Widget*, void*) {
> Fl_Window *win = Fl::first_window();
> while(win)
> {
> Fl_Window *tmp = win;
> win = Fl::next_window(win);
> tmp->hide();
> }
Or you could do it much shorter, as Matt suggested ;-)
while (Fl::first_window()) {
Fl::first_window()->hide();
}
> }
When the first window is hidden, it is removed from the list,
and the next window becomes the new first window, until no
more windows are shown.
...
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk