> 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();
        }
}

int main(int argc, char **argv)
{
  Fl_Double_Window *w1 = new Fl_Double_Window(500, 300, "Win 1");
  w1->box(FL_FLAT_BOX);
  w1->end();
  w1->callback(cb_close);

  Fl_Double_Window *w2 = new Fl_Double_Window(500, 300, "Win 2");
  w2->box(FL_FLAT_BOX);
  w2->end();

  Fl_Double_Window *w3 = new Fl_Double_Window(500, 300, "Win 3");
  w3->box(FL_FLAT_BOX);
  w3->end();

  w1->show(argc, argv);
  w2->show();
  w3->show();

  return Fl::run();
}
/* end of file */
----------------->%---------------------------------



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