FreddieBlassie
Programmer
I am trying to figure out how to recieve the value from a checkbutton when that button is in the on position and a user clicks an entry button. I've been trying a bunch of different methods to get the value to be set in the myproc2 procedure but am having no luck. This is a snippet of the code that i just ran. I have been adjusting it various ways to try and get it right. When I run it as it is right now i get back an error message which reads "Invalid command name ::Chec0" Please help if you can.
proc myproc2 {} {
set txport $[::Chec$b]
ixPuts "txport"
}
toplevel .top
wm title .top "hi"
wm geometry .top 175x300+25+25
frame .top.fr2 -bd 10 -width 5i -height 5i
pack .top.fr2 -side top -ipady 10
frame .top.fr -bd 10 -width 5i -height 5i
pack .top.fr -side top -ipady 10
frame .top.fr3 -bd 10 -width 5i -height 5i
pack .top.fr3 -side bottom -ipadx 50 -ipady 50
message .top.fr.r -width 4i -text "Select port for Testing Station 1"
pack .top.fr.r
###############loop to create buttons and pass value 2 ###############proc myproc2
set b 0
foreach item $portList {
checkbutton .top.fr.$item -text $item -onvalue $item -variable [::Chec$b]
pack .top.fr.$item
incr b
}
message .top.fr2.r -width 4i -text "Enter name for Testing Station 1"
pack .top.fr2.r
entry .top.fr2.entry1 -width 10 -relief sunken -textvariable ::Station1
pack .top.fr2.entry1
button .top.fr3.enter2 -text Enter -command myproc2
proc myproc2 {} {
set txport $[::Chec$b]
ixPuts "txport"
}
toplevel .top
wm title .top "hi"
wm geometry .top 175x300+25+25
frame .top.fr2 -bd 10 -width 5i -height 5i
pack .top.fr2 -side top -ipady 10
frame .top.fr -bd 10 -width 5i -height 5i
pack .top.fr -side top -ipady 10
frame .top.fr3 -bd 10 -width 5i -height 5i
pack .top.fr3 -side bottom -ipadx 50 -ipady 50
message .top.fr.r -width 4i -text "Select port for Testing Station 1"
pack .top.fr.r
###############loop to create buttons and pass value 2 ###############proc myproc2
set b 0
foreach item $portList {
checkbutton .top.fr.$item -text $item -onvalue $item -variable [::Chec$b]
pack .top.fr.$item
incr b
}
message .top.fr2.r -width 4i -text "Enter name for Testing Station 1"
pack .top.fr2.r
entry .top.fr2.entry1 -width 10 -relief sunken -textvariable ::Station1
pack .top.fr2.entry1
button .top.fr3.enter2 -text Enter -command myproc2