I never considered this behaviour that even if logical seems annoying, at least to me. If i have an Entry widged and I enter there a character that is bound to a callback, the callback is called.
Consider the following example:
#!/usr/bin/perl use warnings; use strict; use Tk; # use Tk::WidgetDump; # use Tk::ObjScanner; my $mw = MainWindow->new(); $mw->geometry("100x100"); $mw->Entry( -text => '',-width => 20)->pack(); $mw->bind('<KeyRelease-?>' => sub{print "A question mark was pressed!! +\n"} ); # $mw->WidgetDump(); MainLoop;
When you enter in the Entry widget a question mark the anonymous sub is called. This is a very undesired beahviour for an application with potentially many Entry widgets and potentially many keybindings.
I think I can workaround this putting all Entry in an array @all_text_entries and manually iterating over them to clear all bindings esplicitly set by my application. Even if possible this seems very boring and possibly not so easy to maintain.
Uncomment the Tk::WidgetDump Tk::ObjScanner imports and the $mw->WidgetDump(); to see a very useful dump of all stuffs and bindings too.
Ideas?
L*
PS: sorry for my english that becomes worst due to sleep privation. What i intended to says is: it is possible to disable a keybinding to run it's associated sub if the bound key is entered into an Entry widget?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |