Well, in case it proves useful, here's what I'd do for this example.

This version seems to work just fine (on Vista, I don't have Win7 - but they 
are basically the same AFAIK...) and has the merit of being portable too, and 
works on linux just the same. Hope this helps...

// fltk-config --compile modal_test.cxx

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>

void show_cb(Fl_Widget*, void* d)
{
    Fl_Window* w = (Fl_Window*)d;
    w->show();
}

void hide_cb(Fl_Widget*, void* d)
{
    Fl_Window* w = (Fl_Window*)d;
    w->hide();
}

int main(int argc, char **argv)
{
    Fl_Window *main_win, *ModalOne, *ModalTwo;
    Fl_Button *show1, *show2, *hide1, *hide2;

    // create all the windows - primary window first
    main_win = new Fl_Window(200, 100, "Main Window");
    main_win->begin();
    show1 = new Fl_Button(0, 0, 100, 100, "Show");
    main_win->end();

    // first modal window - modal for the "main_win"
    ModalOne = new Fl_Window(200, 100, "ModalOne");
    ModalOne->begin();
    show2 = new Fl_Button(0, 0, 100, 100, "Show");
    hide1 = new Fl_Button(100, 0, 100, 100, "Hide");
    ModalOne->end();
    ModalOne->set_modal();

    // second modal window - modal for the "ModalOne"
    ModalTwo = new Fl_Window(200, 100, "ModalTwo");
    ModalTwo->begin();
    hide2 = new Fl_Button(100, 0, 100, 100, "Hide");
    ModalTwo->end();
    ModalTwo->set_modal();

    // hook up the callbacks
    show1->callback((Fl_Callback*)show_cb, ModalOne);
    show2->callback((Fl_Callback*)show_cb, ModalTwo);

    hide1->callback((Fl_Callback*)hide_cb, ModalOne);
    hide2->callback((Fl_Callback*)hide_cb, ModalTwo);

    // show the main window
    main_win->show(argc, argv);
    // enter the fltk run loop
    return Fl::run();
}

/* end of file */



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

Reply via email to