Hello everybody,
 
Does anybody know, how to use the tcl "break" function in a Tcl::Tk event 
callback. I saw https://www.perlmonks.org/?node_id=1026146 but I cannot make 
head or tail of it.
 
Here is my simple try, that doesn't work:
 
use Tcl::Tk;
my $int = Tcl::Tk->new();
my $mw = $int->mainwindow();
my $b = $mw->Text()->pack();
$b->bind('<Enter>' => \&enter);
$b->bind('all','<Enter>' => sub {print "This shouldn't be printed\n";});
$int->MainLoop;
sub enter {
    print "hello\n";
    eval {
        $int->Eval('-code break');        
    };
    
}
 
Without the eval in the function enter, I get an error: "command bound to 
event"..
 
Thanks in advance for any help,
Max
 
PS.: Appending a binding with "bind $w +command" works as follows ;-) :
$int->CreateCommand('ent',\&enter);
$b->bind('<Enter>' => '+ent');

Reply via email to