my $t1 = $mw->Scrolled('TextUndo')->pack; my $t1_real = $t1->Subwidget("scrolled"); #### #!/usr/bin/perl use warnings; use strict; use Tk; require Tk::TextUndo; my $mw = tkinit; # create a top bar for testing pure $mw focus my $button = $mw->Button(-text=>'test')->pack(); $mw->bind('', sub { print "main control s \n" }); my $t1 = $mw->Scrolled('TextUndo')->pack; # uncomment the following sections to get different behavior of the # bindings, the test 4 is left uncommented to start, to show proper behavior ##################################################### # test 1 # without any Text control s binding, the text widget prints a # line across the text widget AND a "main control s" to the console ################################################### # test 2 #if we just add a control s binding to the text widget # we get main control s, and text control s printed to console, # and a line printed in the text widget #$t1->bind('', sub { print "\ttext control s\n"; }); #################################################### #test 3 # we get only text control s to the console and the line, # but NO main control s #$t1->bind('', sub { print "\t\tfoo\n"; $_[0]->break }); ##################################################### #test 4 # no line is shown, no line printed, no main control s , # just a foo. # # the order of bindtags is: # class name (Tk::Text), window name, ancestral toplevel, "all" # this modifies the tag list so that the instance binding, # which includes a call to break(), has higher priority # than the class binding $t1->bind('', sub { print "\t\tfoo\n"; $_[0]->break }); $t1->bindtags([($t1->bindtags)[1,0,2,3]]); MainLoop;