Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't destroy window

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
In a tcl program, I have the following function:

proc getIpAddress {} {
global w,Ip_Address
set w .ip_retriever
catch {destroy $w}
toplevel $w
wm resizable $w 0 0
wm transient $w .
label $w.heading -text " Enter IP address "
entry $w.ip_entry -width 18 -textvariable address
frame $w.spaceframe -height 5 -borderwidth 1
button $w.ok_button -text "OK" -command {set Ip_Address $address;
destroy $w}

pack $w.heading $w.ip_entry $w.spaceframe $w.ok_button -side top

}


When I click the "OK" button, the window isn't destroyed and I get an error:

can't read "w": no such variable
while executing
"destroy $w"

Can someone tell me where I went wrong?
 
Replace
button $w.ok_button -text "OK" -command {set Ip_Address $address; destroy $w}
by
button $w.ok_button -text "OK" -command "set Ip_Address \$address; destroy $w"
to have $address replaced at response time and $w replaced at compile time.

ulis
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top