home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!spool.mu.edu!uwm.edu!cs.utexas.edu!torn!nott!bnrgate!bcars6a8!bnr.ca!norm
- From: norm@bnr.ca (Norm MacNeil)
- Subject: re:suspending events
- Message-ID: <1992Dec22.163736.5832@bcars6a8.bnr.ca>
- Sender: usenet@bcars6a8.bnr.ca (Use Net)
- Nntp-Posting-Host: bcarh1ff
- Reply-To: norm@bnr.ca
- Organization: Bell-Northern Research Ltd.
- Date: Tue, 22 Dec 1992 16:37:36 GMT
- Lines: 51
-
- In article <1992Dec22.141509.28807@choreo.ca>, you write:
- |> I have a tcl/tk script which handles some error processing, and displays
- |> a dialog box with the information message to the user when an error occurs.
- |> I set focus to the error window. How do I keep the script from executing
- |> until the user presses the OK button?
- |>
- |> For example
- |>
- |> if .... {
- |> errorDialog "message"
- |> update
- |> }
- |> <- I don't to continue here until an OK button is pressed.
- |> more code
- |> ...
- |>
- |>
- |> proc errorDialog {} {
- |> ....
- |> }
-
- I had the same requirements, so I cannabalized (sp?) the mkDialog.tcl in the
- .../library/demos directory to do the following...
-
- proc error Dialog {Msg} {
-
- # make toplevel window called, say, .FooBar
- # with a button at the bottom...
-
- button .FooBar.bottom.Ok -text "Cancel" -width 15 -command ".destroy .FooBar"
-
- # Other stuff here...
-
- bind .FooBar <Visibility> {focus .FooBar}
- grab .FooBar
- focus .FooBar
- tkwait window .FooBar
- }
-
- The important line is the last one where tkwait waits until the window specified
- no longer exists.
-
-
- --
- Norm.
-
- +-----------------------------------------------------------------------+
- Norm MacNeil Phone: (613) 763-3372
- Data Systems Fax: (613) 765-2854
- Bell-Northern Research Ltd. EMail: norm@bnr.ca (INTERNET)
- #include <disclaimer.std> "Roller bladers do it in-line!"
-