Bind toplevel ($mw) to warn on Key-questionmark
also bind so children of $mw of "tag" Tk::Entry break
at first MainWindow has focus, then tab is hit so focus is on the buttons ... when entry has focus nothing is printed
#!/usr/bin/perl -- use strict; use warnings; use Tk; my @t = ( -text => 'focus on me and press ?' ); my $mw = tkinit; $mw->Checkbutton( @t )->pack; $mw->Button( @t )->pack; $mw->Entry( @t )->pack; $mw->bind(q/<Key-?>/,sub{warn "$Tk::widget ? " }); $mw->bind(qw/Tk::Entry <Key-?>/,sub{Tk->break}); MainLoop; __END__ MainWindow=HASH(0xf1eeec) ? at - line 10. MainWindow=HASH(0xf1eeec) ? at - line 10. MainWindow=HASH(0xf1eeec) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Button=HASH(0xf42c0c) ? at - line 10. Tk::Button=HASH(0xf42c0c) ? at - line 10. Tk::Button=HASH(0xf42c0c) ? at - line 10. Tk::Button=HASH(0xf42c0c) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10. Tk::Checkbutton=HASH(0xf55164) ? at - line 10.
In reply to Re: Tk preventing a char in Entry widged to trigger a KeyBinding
by Anonymous Monk
in thread Tk preventing a char in Entry widged to trigger a KeyBinding
by Discipulus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |