Using foreach loop to create radiobutton menu
- From: aj@xxxxxxxxxx
- Date: 28 Apr 2006 06:54:06 -0700
As it stands now, I have code that looks somethign like this....
menubutton range -text "Set Range" -underline 0 -bd 0 -menu {
radiobutton range1 -label "1" -command {
# do something...
}
.
.
.
radiobutton range10 -label "10" -command {
# do something...
}
}
I am trying to do the same thing in a foreach loop. I keep getting an
error though saying variable range does not exists: Here is that
code...
menubutton range -text "Set Range" -underline 0 -bd 0 -menu {
foreach range {1 2 3 4 5 6 7 8 9 10} {
radiobutton range$range -label $range -command {
puts "hello: $range"
}
}
}
I understand that range is out of scope. Can anyone tell me how to
make it so it is in scope? I tried using upvar and uplevel to no
avail.
.
- Follow-Ups:
- Re: Using foreach loop to create radiobutton menu
- From: Bryan Oakley
- Re: Using foreach loop to create radiobutton menu
- Prev by Date: Re: How to export postscript from canvas?
- Next by Date: Re: How to interpet Tcl/Tk stack information.
- Previous by thread: How to control the loop within expect.
- Next by thread: Re: Using foreach loop to create radiobutton menu
- Index(es):