Lock Selection to a popup window 
Author Message
 Lock Selection to a popup window

I wrote a tcl program that quizzes kids on spelling by displaying a picture
and 3 words one of which is the spelling of the picture.  The whole thing
works great except I can;t figure out 1 thing.  When the child makes a
choice I popup either a Happy Face or a Sad Face into a new toplevel
window.  The only button is an OK (really Close) button that has the command
{destroy .f_}.  If the child goes back and clicks on the main application
before clicking the OK button on the .f toplevel it errors the program
becuase it tries to create another .f.  I have solved that by checking for a
.f before accepting a word choice in the main window.

It would be way simpler to lock the input the the popup window until close
is chosen.  Can this be done in TCL, and if so how.  I have scoured the
dev.scriptics.com website html manuals and can;t find an answer

Thanks for any help

Ermac!!!



Sun, 16 Mar 2003 03:00:00 GMT  
 Lock Selection to a popup window

Quote:

> I wrote a tcl program that quizzes kids on spelling by displaying a picture
> and 3 words one of which is the spelling of the picture.  The whole thing
> works great except I can;t figure out 1 thing.  When the child makes a
> choice I popup either a Happy Face or a Sad Face into a new toplevel
> window.  The only button is an OK (really Close) button that has the command
> {destroy .f_}.  If the child goes back and clicks on the main application
> before clicking the OK button on the .f toplevel it errors the program
> becuase it tries to create another .f.  I have solved that by checking for a
> .f before accepting a word choice in the main window.

> It would be way simpler to lock the input the the popup window until close
> is chosen.  Can this be done in TCL, and if so how.  I have scoured the
> dev.scriptics.com website html manuals and can;t find an answer

> Thanks for any help

> Ermac!!!

You might look at doing this:

toplevel .f_
wm transient .f_ .
grab .f_

Then after the close button is pressed
do:

grab release .f_
destroy .f_

I hope that helps.

--Dan



Sun, 16 Mar 2003 03:00:00 GMT  
 Lock Selection to a popup window
Thanks!!!

Much Appreciated

ErMac!


Quote:

> > I wrote a tcl program that quizzes kids on spelling by displaying a
picture
> > and 3 words one of which is the spelling of the picture.  The whole
thing
> > works great except I can;t figure out 1 thing.  When the child makes a
> > choice I popup either a Happy Face or a Sad Face into a new toplevel
> > window.  The only button is an OK (really Close) button that has the
command
> > {destroy .f_}.  If the child goes back and clicks on the main
application
> > before clicking the OK button on the .f toplevel it errors the program
> > becuase it tries to create another .f.  I have solved that by checking
for a
> > .f before accepting a word choice in the main window.

> > It would be way simpler to lock the input the the popup window until
close
> > is chosen.  Can this be done in TCL, and if so how.  I have scoured the
> > dev.scriptics.com website html manuals and can;t find an answer

> > Thanks for any help

> > Ermac!!!

> You might look at doing this:

> toplevel .f_
> wm transient .f_ .
> grab .f_

> Then after the close button is pressed
> do:

> grab release .f_
> destroy .f_

> I hope that helps.

> --Dan



Sun, 16 Mar 2003 03:00:00 GMT  
 Lock Selection to a popup window

Quote:

> You might look at doing this:

> toplevel .f_
> wm transient .f_ .
> grab .f_

> Then after the close button is pressed
> do:

> grab release .f_
> destroy .f_

You might also consider withdrawing and deiconifying the same window
instead of destroying and recreating it.  Something like this:

  proc popup_dialog {} {
    if { ! [winfo exists .f] } {
      toplevel .f
      grid [button .f.b -text close -command {wm withdraw .f}]
    }
    wm deiconify .f
  }

Bob
--

Mayo Foundation                                           (507) 284-2702
Rochester MN, 55905 USA   http://www.mayo.edu/sppdg/sppdg_home_page.html



Mon, 17 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Tk popup. Cannot get notification of selection

2. Popup OK under tk3.4, locks under tk3.6

3. num lock, caps lock, scroll lock lights

4. Problem with mouse wheel and popup under windows

5. Hiding menu in popup-window

6. Windows Explorer Popup menu options

7. Instant messenger type popup windows

8. Popup window doesn't close (BUG?)

9. controls with template on a popup-window?

10. Popup help window won't display

11. Disable javascript to avoid popup windows.

12. popup window with "anchor" node

 

 
Powered by phpBB® Forum Software