Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to unbind all binds for a widget 1

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
I have a text widget and at some point it is being redrawn and for that instant i dont want the binds to be present, testers found a tcl error when they were able to click fast enough.

I'm looking for something along the lines of

$text bind <*> { }

but obviously this doesnt work.

Is there a command that will unbind all binds on 1 widget, or do i really have to go through unbinding every last one of them.
 
I've never done this but it would appear that the [red]bindtags[/red] command is supposed to do what you want.

The bindtags command may be used to introduce arbitrary additional binding tags for a window, or to remove standard tags. For example, the command

bindtags .b {.b TrickyButton . all}

replaces the Button tag for .b with TrickyButton. This means that the default widget bindings for buttons, which are associated with the Button tag, will no longer apply to .b, but any bindings associated with TrickyButton (perhaps some new button behavior) will apply

So, instead of [red]TrickyButton[/red], maybe you could have a null binding tag that you can use to replace the binding on your text widget?

_________________
Bob Rashkin
 
This makes sense to me. But i guess i dont understand what "trickybutton" is supposed to be. That argument is supposed to be a taglist.


lets take the following example, one button that puts out "hello" when clicked:

frame .f
button .f.b -text hello
pack .f .f.b
bind .f.b <ButtonPress-1> "puts hello"

bindtags .f.b { .f.b ????? . all }



what does ????? have to be to remove that bind?
 
As I say, I've never used this, but it seems that TrickyButton, in the example, is another binding tag with another behavior (say, nothing).

Let's say you bind your text widget, .f.t, to some behavior:
bind .f.t <Button-2> bindingProc

Now define a null binding:
bind DoNothing <<coast>> ""

Presumably, you can now use the "DoNothing" tag to replace the binding on the widget, at least according to the help file.

_________________
Bob Rashkin
 
I'll have to play around with it. Still not removing the bind like i was hoping.

But thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top