event occurs on tk_optionmenu change of value?
Hello,
I have a tcl application that includes the use of tk_optionmenus.
There are times when I would like something to happen when a user
selects something on the tk_optionmenu, for example, if I have a
tk_optionmenu called .top.fruits, and the user selects apples, I might
want to populate another tk_optionmenu .top.type with "granny_smith
golden_delicious", etc -- for oranges I might want "mandarin navel,"
etc. Right now, I am doing this, but I have to put a button next to
the tk_optionmenu called "form" which, when pressed, calls a tcl
procedure to then apply the appropriate widgets based on the users
choices. This seems to work okay, but Windows users are used to
drop-down-list-boxes that automatically change widgets when a new value
is selected without having to resort to using a "form" button or
something. Users are complaining about its presence there.
I'm sure there is a way to do this in tcl also. What I need is some
way to set an event on the change of value of the variable behind the
tk_optionmenu, so when it changes, it will then change the other
widgets based on the value of the first optionmenu. Trouble is, I
don't know how to do that. Is there anyone who can show me how?
Thanks!
|