When the window for our drawing tool loads up it accesses our database
through C functions to find the names of the buttons and there
drop down menu names that we want displayed on the screen
###########################################################
proc pulldownmenu {} {
global celltype no_of_cells
set i 0
foreach celltype { Horse Pony Tack Corner Shelter Feed } {
menubutton .cells.mb$i -text $celltype -menu .cells.mb$i.menu -height 1 -width 8 -relief raised
set m [menu .cells.mb$i.menu -tearoff 0]
foreach no_of_cells { Small Medium Large ExtraLarge } {
$m add command -label $no_of_cells
-command {startCell $celltype $no_of_cells}
}
incr i 1
}
pack .cells.mb0 .cells.mb1 .cells.mb2 .cells.mb3 .cells.mb .cells.mb5 -padx 10 -pady 10 -side top -fill y
grid config .cells -column 1 -row 2 -columnspan 1 -rowspan 1 -sticky "snew"
}
pulldownmenu
###########################################################
The 'foreach no_of_cells ... ' part of the code is not like this in our final code but this is a simplified
version where no database info is needed.
Once the buttons have been created and displayed on screen , we need to be able to press a button
and for the procedure called 'startCell' to be called , as you can see in the pull down menu procedure
-command {startCell $celltype $no_of_cells}
The problem is that the buttons all get the variables $cellType and $no-of-cells set to the values they were last set
(eg. always feed and extra large) to and not the values of the variables at the time they were set
If you can understand my explanation , which was very difficult to put into words,
can you suggest a way to make this work as I dont have a clue ?
THANKS LOTS
STEVE
through C functions to find the names of the buttons and there
drop down menu names that we want displayed on the screen
###########################################################
proc pulldownmenu {} {
global celltype no_of_cells
set i 0
foreach celltype { Horse Pony Tack Corner Shelter Feed } {
menubutton .cells.mb$i -text $celltype -menu .cells.mb$i.menu -height 1 -width 8 -relief raised
set m [menu .cells.mb$i.menu -tearoff 0]
foreach no_of_cells { Small Medium Large ExtraLarge } {
$m add command -label $no_of_cells
-command {startCell $celltype $no_of_cells}
}
incr i 1
}
pack .cells.mb0 .cells.mb1 .cells.mb2 .cells.mb3 .cells.mb .cells.mb5 -padx 10 -pady 10 -side top -fill y
grid config .cells -column 1 -row 2 -columnspan 1 -rowspan 1 -sticky "snew"
}
pulldownmenu
###########################################################
The 'foreach no_of_cells ... ' part of the code is not like this in our final code but this is a simplified
version where no database info is needed.
Once the buttons have been created and displayed on screen , we need to be able to press a button
and for the procedure called 'startCell' to be called , as you can see in the pull down menu procedure
-command {startCell $celltype $no_of_cells}
The problem is that the buttons all get the variables $cellType and $no-of-cells set to the values they were last set
(eg. always feed and extra large) to and not the values of the variables at the time they were set
If you can understand my explanation , which was very difficult to put into words,
can you suggest a way to make this work as I dont have a clue ?
THANKS LOTS
STEVE