I need to identify the button the user has pushed within it's own command script. The buttons are identical but each operate on a different cell (frame). An example that somewhat demonstrates the problem follows:
The path to the menu items cannot be known since it is within the command script of the that button. If it is possible to identify the "Show Menu" button's path within it's own command script then the cell can be identified -- but I don't know how to do that. Can anyone help me?
Code:
proc myButtons {path} {
button $path.btnmnu -text "Show Menu" -command {
# Is there a way to determine the button path here (after it has been clicked)?
# If so able then we know on which frame the selected menu item much apply to
foreach itm [list Save Load Quit] {
button $path.btn$itm -text $itm
grid $path.btn$itm
}
}
grid $path.btnmnu
}
for {set i 0} {$i < 10} {incr i} {
frame .fra$i -bd 2 -relief sunken -padx 4 -pady 4
myButtons .fra$i
grid .fra$i -sticky ew
}
The path to the menu items cannot be known since it is within the command script of the that button. If it is possible to identify the "Show Menu" button's path within it's own command script then the cell can be identified -- but I don't know how to do that. Can anyone help me?