Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Application starter.

6 views
Skip to first unread message

John Culleton

unread,
Sep 22, 2005, 8:44:46 AM9/22/05
to
I want to create an system that begins with a main menu bar. When an item is
selected from the menu bar (which may be cascaded) then a second main
window appears and the original window disappears or becomes inactive.
When the second window exits then the original window reappears and is
functional again.

Assuming that the second window is created via a proc
should I use the "withdraw" function of the main menu? Should the sequence
be:
proc foo
{wm withdraw .w
(draw subordinate window)
wm deiconify .w
}
??
..or do I need to reactivate the first window as part of the exit routine of
the second window?

--
John Culleton

Donald Arseneau

unread,
Sep 22, 2005, 10:53:00 PM9/22/05
to
John Culleton <jo...@wexfordpress.com> writes:

> {wm withdraw .w
> (draw subordinate window)
> wm deiconify .w

No.

> ..or do I need to reactivate the first window as part of the exit routine of
> the second window?

Yes.

I like to pick some inocuous label in the "second window"
and bind the action to destruction of that widget.

bind .w2.labxxx <Destroy> { wm deiconify .w }

Instead of just [deiconify], you probably should do:

if { [winfo exists .w] } {
wm deiconify .w
raise .w
}

If you bind to .w2 directly, the event fires when any and every
widget within .w2 is destroyed (see bindtags). But if you feel
is is morally superior to sample the destruction of .w2 itself,
then you should test:

if { [winfo toplevel %W] eq %W } { ...


--
Donald Arseneau as...@triumf.ca

0 new messages