Millan wrote:
> I omitted them because even with them result is the same.
> The following:
> 
>                         begin();
>                                 win = new Window(100, 100);
>                                 win->begin();
>                                 win->end();
> 
>                                 menu = new PopupMenu(0, 0, w, h);
>                                 menu->type(PopupMenu::POPUP3);
>                                 menu->begin();
>                                         about_item = new Item("About clock");
>                                         exit_item = new Item("Exit clock");   
>   
>                                 menu->end();
>                                 menu->callback(cb_menu, this);
>                         end();

        I think you'll find if you re-arrange the code so that
        one window is not defined inside the other, it will work.
        (Because the second window is really a separate window)

        eg:


                         // First window
                         begin();
                                 // menu a child of first window
                                 menu = new PopupMenu(0, 0, w, h);
                                 menu->type(PopupMenu::POPUP3);
                                 menu->begin();
                                         about_item = new Item("About clock");
                                         exit_item = new Item("Exit clock");
                                 menu->end();
                                 menu->callback(cb_menu, this);
                         end();
                         color(12);
                         show();

                         // Second window
                         win = new Window(100, 100);
                         win->begin();
                             // put widgets in second window here
                         win->end();
                         win->show();


        That puts the menu on the first window.
        If you want it in the second window, just move the menu code
        between the win->begin() and win->end().

        From what I can tell, since the windows are separate, it doesn't
        (seem) to make sense to define one inside the definition of the
        other. I think what was happening in your case is the definition
        of the second window implied end()ing the first. I think.
        Maybe the developers can weigh in on this one; I'm not too
        familiar with fltk 2.0 to know if that's how it's supposed to work.

        But I think re-arranging the code so that the windows are defined
        separately makes sense, as they really are separate.

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

Reply via email to