From: Keith on 4 Feb 2010 16:08 I'm trying to use a spinbox to set a value that is retrieved from a string, the problem is that the spinbox value is not set to what the variable is: $ton(dly) = "INF" set dly {0 1 2 5 10 30 INF} spinbox $t.h.l -values $dly -textvariable ton(dly) -state readonly -width 4 -wrap 1 but the spinbox only displays the first value of 0 instead of $ton(dly), but it will set the ton(dly) to the proper value for programming. How do I get the spinbox to set/display the value of $ton(dly) instead of the first selection available ? Thanks for any help. -- Best Regards, Keith http://home.comcast.net/~kilowattradio/ Tired of Google Groups? http://home.comcast.net/~kilowattradio/usenet.html
From: Uwe Klein on 4 Feb 2010 17:13 Keith wrote: > I'm trying to use a spinbox to set a value that is retrieved from a > string, the problem is that the spinbox value is not set to what the > variable is: > you've trespassed into other language territory ;-) THEY will come to get you! replace > $ton(dly) = "INF" with set ton(dly) "INF" > set dly {0 1 2 5 10 30 INF} > spinbox $t.h.l -values $dly -textvariable ton(dly) -state readonly > -width 4 -wrap 1 then it works for me ( with .l as widget path and a final [ pack .l ] uwe
From: Keith on 4 Feb 2010 18:27 On Thu, 04 Feb 2010 23:13:24 +0100, Uwe Klein <uwe_klein_habertwedt(a)t-online.de> wrote: > Keith wrote: > > I'm trying to use a spinbox to set a value that is retrieved from a > > string, the problem is that the spinbox value is not set to what the > > variable is: > > > you've trespassed into other language territory ;-) > > THEY will come to get you! > > replace > > $ton(dly) = "INF" > with global ton set ton(dly) "INF" set dly {0 1 2 5 10 30 INF} spinbox .l -values $dly -textvariable ton(dly) -state readonly -width 4 -wrap 1 pack .l Well I executed this in the tcl console and the 0 was what appeared. I'm using tcl8.5, if that makes a difference. > > uwe -- Best Regards, Keith http://home.comcast.net/~kilowattradio/ Tired of Google Groups? http://home.comcast.net/~kilowattradio/usenet.html
From: Gerald W. Lester on 4 Feb 2010 23:11 Keith wrote: > On Thu, 04 Feb 2010 23:13:24 +0100, Uwe Klein > <uwe_klein_habertwedt(a)t-online.de> wrote: > >> Keith wrote: >>> I'm trying to use a spinbox to set a value that is retrieved from a >>> string, the problem is that the spinbox value is not set to what the >>> variable is: >>> >> you've trespassed into other language territory ;-) >> >> THEY will come to get you! >> >> replace >>> $ton(dly) = "INF" >> with > global ton > set ton(dly) "INF" > set dly {0 1 2 5 10 30 INF} > spinbox .l -values $dly -textvariable ton(dly) -state readonly > -width 4 -wrap 1 > pack .l > > > Well I executed this in the tcl console and the 0 was what appeared. I'm > using tcl8.5, if that makes a difference. The global ton is not needed. You can move the set ton(dly) "INF" to after the pack. Otherwise there seems to be some issue with the spinbox initialization (i.e. a bug). -- +------------------------------------------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
From: Uwe Klein on 5 Feb 2010 03:56 Keith wrote: > On Thu, 04 Feb 2010 23:13:24 +0100, Uwe Klein > <uwe_klein_habertwedt(a)t-online.de> wrote: > > >>Keith wrote: >> >>>I'm trying to use a spinbox to set a value that is retrieved from a >>>string, the problem is that the spinbox value is not set to what the >>>variable is: >>> >> >>you've trespassed into other language territory ;-) >> >>THEY will come to get you! >> >>replace >> >>>$ton(dly) = "INF" >> >>with > > global ton > set ton(dly) "INF" > set dly {0 1 2 5 10 30 INF} > spinbox .l -values $dly -textvariable ton(dly) -state readonly > -width 4 -wrap 1 > pack .l > > > Well I executed this in the tcl console and the 0 was what appeared. I'm > using tcl8.5, if that makes a difference. I used 8.4, run at "global" level, but just tested my senile version of 8.5 doesn't balk either. Does your code run inside a proc? <my script> #!/usr/bin/wish set ton(dly) "INF" set dly {0 1 2 5 10 30 INF} spinbox .l -values $dly -textvariable ton(dly) -state readonly -width 4 -wrap 1 pack .l #end uwe
|
Next
|
Last
Pages: 1 2 Prev: Musings while learning Tcl by parsing XML with tDOM Next: when did mini.net go by the wayside? |