Yeah, you are right. I saw that \x{13} and just thought it was unicode not being properly handled, like maybe your shell settings were en_US instead of en_US.UTF-8, (or some such confusion :-)) But now that I woke up, :-) I think it might have to do with the bindtag order with the way you have control s bindings for both the $mw and the Text widget.

This is about all I can figure out. My guess is the \x{13} is the text widget trying to print the line ( which is normal behavior), but the $mw binding is somehow messing it up. If the below setting of the bindtags dosn't help, I would guess you have a defective Tk installation? Can you reinstall Tk? What version of Tk and Perl are you running? Does the following script give good behavior? I left the "test 4" uncommented. Play with it and see what happens. Otherwise, post a self contained complete mini example that demonstrates the problem.

I just diid notice a different behavior for the Text::Undo vs the plain Text widget, and if the widget is Scrolled or not. So you may want to try binding to the REAL text widget, not the Scrolled widget. I noticed with a Scrolled widget, the line gets printed, whearas in the plain widget it does not. Also, can you test your real script with a Scrolled Text instead of a Scrolled TextUndo?

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('<Control-s>', 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 be +havior ##################################################### # 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('<Control-s>', 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('<Control-s>', 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('<Control-s>', sub { print "\t\tfoo\n"; $_[0]->break }); $t1->bindtags([($t1->bindtags)[1,0,2,3]]); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: Tk hidden binding by zentara
in thread Tk hidden binding by emilbarton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.