Stan wrote:
>> I'm thinking that when you do the parent(0); thing,
>> you are basically unparenting one window from the other
>> (if they were parented, they wouldn't be separate)
>> so you'd have to delete each window separately.
>>
>> If you want one to be destructed by the other,
>> I think you'd need to keep the pointer to win2
>> inside win1, and have win1's dtor take it out.
>
> Right. But look at the example again: I commented out
> the parent(0), and the child window still doesn't get destructed.
> That's the surprise.
I think the only thing you're guaranteed wrt to destruction
is if you destroy a window, its child widgets will be destroyed.
ie. not other (separate) windows.
An Fl_Window can either be a separate window, or part of another
window. I imagine it only destructs when it's 'part of' another window.
I don't think 'separate' windows are considered child widgets.
For instance, if you modify the program to show() both windows,
comment out the delete and return(Fl::run()), you'll see two
separate windows, not one as a widget inside the other.
This is because only the w/h values are specified; to make
a window a widget inside the other, the x/y/w/h values need
to be specified. This was covered just recently in a parallel
thread:
Subject: FLTK 2.x Creating PopupMenu menu before/after creating
subwindow. Bug?
The way to really see what's going on is to look at fltk's
own code (ie. Fl_Window's and Fl_Group's destructor, I'd think)
which is what I do when I'm not sure I can tell just from the
docs alone.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk