This well also work.

button .nslookup$ctr.b -text Dismiss -command "destroy
.nslookup$ctr"

The {} brackets keep the $ctr from being translated.

[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> I'm having a small problem with a bit of code.  I've made a procedure
> that creates a new toplevel window with a message in it each time a
> button is pressed.  I've used a counter variable that is incremented
> each time the button is pressed, and the number is appended at the end
> of the message name.  As an example, .nslookup$ctr  I'm also trying to
> add a button at the bottom of the window that will destroy the widget,
> but with the counter being incremented I can kill the last window I
> create, but not any of the other ones.  Can anyone help me figure out
> how to do this.  Any help would be greatly appreciated.
> 
> Here is the code:
> 
> global ctr
> set ctr [ expr $ctr + 1 ]
> toplevel .nslookup$ctr
> wm title .nslookup$ctr NSLOOKUP
> set data ""
> set fileid [open "|nslookup sunsite.unc.edu" r]
> if { $fileid != "" } {
>     set data [read $fileid]
>     close $fileid
> }
> message .nslookup$ctr.msg -text $data
> button .nslookup$ctr.b -text Dismiss -command { destroy .nslookup$ctr }
> pack .nslookup$ctr.msg -side top
> pack .nslookup$ctr.b -side bottom
> --
> 
> --------------------------------------------------------------------------------
>                                         |
>   Ed Coates                             | Jesus Saves... Passes to Moses
>   [EMAIL PROTECTED]                  | He shoots!   He scores!
>                                         |
> --------------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------------
> To unsubscribe from the Visual Tcl mailing list, please send a message
> to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
> message body (where [EMAIL PROTECTED] is your e-mail address).
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to