For Programmers: Free Programming Magazines  


Home > Archive > Tcl > September 2005 > Application starter.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Application starter.
John Culleton

2005-09-22, 7:57 am

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

2005-09-22, 9:58 pm

John Culleton <john@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 asnd@triumf.ca
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com