ActiveState Community

bind problem/usage?

Posted by marczuckman on 2009-02-09 20:54
OS: Linux

I am using Activestate Tcl 8.4.7.0

It is unclear to me if I am encountering a bug, which I doubt, or if I just don't understand Tcl/Tk programming.

I create an array of menubuttons in an Iwidgets scrolledframe.

Each menubutton is mapped into a row and column using the grid widget manager.

Each menubutton is "bound" to two events as follows:

bind menubut EnterEvent {script one}
bind menubut Button-3event {script two}

script two does the following (and more)
bind menubut EnterEvent "" ; grid forget menubut ; destroy menubut
and then creates a newmenubut which is "gridded" into the same row and column that was occupied by the original menubut. newmenubut is bound to the same events as the original menubut

The problem is that when the cursor Enters the row and column of newmenubut, the script that is executed is the script for the original menubut, which no longer exists. Of course, this results in a bunch of errors.

What am I doing incorrectly? (Please note: The "code" used above is a paraphrase of the actual code. Not only that, but the forum did not let me convey the actual syntax for the bind events which I tried to enclose within angle brackets as it actually appears in the program.)