#!/usr/bin/perl use strict; use warnings 'all'; use Tk; use Tk::Text; use Hook::WrapSub qw(wrap_subs); wrap_subs sub { warn "called focus with args @_" }, 'Tk::focus', sub {}; my $mw = tkinit; my $text = $mw->Scrolled("Text", -scrollbars => 'ose', -background => 'white', -wrap => 'none') ->pack(-fill => 'both', -expand => 1); $text -> focus(); # Ändern der bind-Reihenfolge my @tags = $text->Subwidget("scrolled")->bindtags; @tags[0,1]=@tags[1,0]; $text->Subwidget("scrolled")->bindtags([@tags]); $text -> bind('', sub { $text->focus(); $text->break; }); MainLoop; __END__ called focus with args Tk::Text=HASH(0x82dcd14) at /tmp/a.pl line 8. called focus with args Tk::Text=HASH(0x82dcd14) at /tmp/a.pl line 8. called focus with args Tk::Text=HASH(0x82dcd14) at /tmp/a.pl line 8.