michael sephton wrote:
> win = new Window(100, 100);
> vs.
> win = new Window(0,0,100, 100);
Mmm, interesting.. I didn't know specifying the x/y or not made
a difference in behavior of creating the separate window, I thought
it was just the parent()/current() thing.
When there is no parent, both (100,100) and (0,0,100,100) make separate
windows, so since I always created windows when there was no parent,
I'd never run into this.
So with regard to the OP, I'm not sure this solves the question.
The original code posted made two separate windows, but didn't
cite that as a problem, just the menu not showing up. In a recent
message the OP says they didn't want separate windows. OP: Was it
also a problem that the program you posted created two windows
and not one?
Based on the above, I can get the program to work either with
separate windows (if defined separately, one after the other),
or with a subwindow if one is defined inside the other with the
x/y/w/h specified for the subwindow.
What /doesn't/ work is if you try to declare separate windows
where one is created inside the begin()/end() of the outer,
the way the OP posted it.
The inner window's end() seems to also end() the outer window
as well, such that creating the popup doesn't get attached to either
window.
The only workaround I see is to add another begin() before
defining the popup, eg:
MainWindow(int w, int h, char *s = 0): Window(w, h, s) {
begin();
win = new Window(100, 100);
win->begin();
win->end();
begin(); // ADDED THIS (but why should it be needed?)
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();
win->show();
}
So I think what the OP is reporting is that the inner window's end()
is also apparently end()ing the outer window. Adding the extra begin()
seems to help it work, so it seems like FLTK doesn't want one to create
separate windows this way, one inside the other..? I'm assuming the OP
is doing this to get some kind of parent/child relationship between
the two separate windows (eg. so if the 'child' is modal, it only stays
in front of its 'parent', and not any other of the app's windows)
Maybe that's a bug, I'm not sure.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk