> It tried your example and it worked (means: the subwindow was closed 
> when I pressed the "hide" Button even if the subwindow was 
> modal)! Then 
> I compared your example with my code...
> 
> I did the following wrong: I defined the subwindow INSIDE the 
> begin() - 
> end() "space" of the main window.

Ah. No, you did not want to do that.
If you do that, you get a "child" window, not a "sub" window, as it
were.

The difference is that the "child" window is embedded in the main
"parent" window, similar to a group - in practice there are only a few
cases where this is a useful thing to do.

If you want a free-floating "sub"-window, it must be declared outside
the begin/end of the parent window then associated with the parent using
the modal/non-modal flag settings.

If you create the "sub"window in this way but do not associate it with a
parent window, then it becomes an independent top-level "parent" window
in its own right.

Does that help you?

Note also that the fact that you had created a "child" window sheds some
light on the other behaviours you describe.
When you hide a "child" window, a "latent" image of it will remain on
the display (because a hidden child does not get redrawn) so you need to
redraw the *parent* window to erase this latent image...
I suspect this is what was happening in your test - the child window was
hidden, but the display was not refreshed, so you were clicking on the
latent image and wondering why the buttons did not respond... Does that
make sense?

> Questions:
> 
> - Is simply the first window which is defined the parent 
> window? Or has 
> it to do with the special show() with the arguments argc and argv 
> inside? -> How does FLTK know which window the main window is?

I think that whichever window is "current" is taken as the parent for
attaching a modal window to.
So you can have several "top level" windows, each with some sub-windows
modal to it, if that is what you want.
You can set which top-level window is current in several ways, but the
simplest way is often just to call show() on the window before making
the sub-windows modal.


> - How does FLTK know that a window is a child window?

See above.

> Is simply every 
> window definitioned after show(argc, argv) of the parent 
> window a child?

No, unless you make a window explicitly modal or non-modal it will be a
full top-level window in its own right. Remember always that modality is
tri-state, not bi-state.

The show(argc,argv) is no different from a show() call, in this respect
(although it does cause loading of internal system defaults that a plain
show() does not. See also Fl::get_system_colors() and Fl::args(...) for
some background on that.)

> - If I want another parent window; how had I to do this?

You just create it and show it. If you do not associate it with another
top-level window, then it becomes a top-level window itself.

-- 
Ian





SELEX Sensors and Airborne Systems Limited
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