They're using Perl 5.8 Build 804. I've determined that this only happens in my code. I do have a binding on KeyPress, but the problem persists even with thatgone.

Here's the code that initializes the Text widget $self->{bottom}: (BrowseEdit is derived from Tk::Text and makes bindings on <Control-B>, <Control-U>, and <Control-I>

$self->{bottom} = $self->{frame}->Scrolled("BrowseEdit", -height => 6, -font => "times 12", -scrollbars => 'oe', -wrap +=> 'word', -spacing1 => 0, -spacing2 => 0, -spacing3 => 0)-> pack(-expand => 1, -fill => 'both', -padx => 5); $self->{typing} = $self->{frame}->Label->pack(-anchor => 'w'); $self->{frame}->Button(-text => "Send", -command => [$self, "on_se +nd"])-> pack(-pady => 3, -side => 'right', -anchor => 'center'); $self->{frame}->Button(-text => "Get Profile", -command => [$self, + "on_prof"])-> pack(-pady => 3, -side => 'left', -anchor => 'center'); # WIDGET CREATION END $self->{top}->tagConfigure('self', -foreground => 'red', -font => +'times 12 bold'); $self->{top}->tagConfigure('buddy', -foreground => 'blue', -font = +> 'times 12 bold'); $self->{top}->tagConfigure('self_stamp', -foreground => 'red', -el +ide => 1, -font => 'times 9 bold'); $self->{top}->tagConfigure('buddy_stamp', -foreground => 'blue', - +elide => 1, -font => 'times 9 bold'); $self->{bottom}->bind("<Return>", [$self, "on_send"]); $self->{bottom}->bind("<Escape>", [$self, "destroy"]); $self->{bottom}->bind("<KeyPress>", [$self, "on_key"]); $self->bind("<F2>", [$self, "toggle_stamps"]); $self->{top}->bind('<MouseWheel>', [ sub { $_[0]->yview('scroll', -($_[1] / 120), 'units') }, Tk: +:Ev('D')]); $self->{bottom}->bind('<MouseWheel>', [ sub { $_[0]->yview('scroll', -($_[1] / 120), 'units') }, Tk: +:Ev('D')]); # $self->bind('<Configure>', [sub { # my ($width, $height) = @_; # set_option('ConvoHeight', $height); # set_option('ConvoWidth', $width); # }, Ev('w'), Ev('h')]); $self->{bottom}->configure(-background => 'white'); $self->{me} = data("me"); $self->{buddy} = $buddy; $self->{empty} = 1; $self->{last_typed} = time; $self->{typing_status} = 0; $self->update; $self->geometry("480x320"); $self->deiconify; hook("tk_seticon", -wnd => $self); $self->OnDestroy([$self, "on_destroy"]); $self->{bottom}->focus; $self->{rep_id} = $self->repeat(1000, [$self, "update_status"]);
and here's the code for on_key:
sub on_key { my ($self) = @_; print "in handler\n"; if($self->{typing_status} == 0) { print "key change\n"; hook("protocol_set_typing_status", -user => $self->{buddy}, -s +tatus => 2); $self->{typing_status} = 2; } $self->{last_typed} = time; }
and for update_status:
sub update_status { my ($self) = @_; print "in update\n"; if($self->{bottom}->get('0.0', 'end') =~ /^\s*$/ && $self->{typing +_status}) { hook("protocol_set_typing_status", -user => $self->{buddy}, -s +tatus => 0); $self->{typing_status} = 0; return; } if((time - $self->{last_typed}) >= 5 && $self->{typing_status} == +2) { hook("protocol_set_typing_status", -user => $self->{buddy}, -s +tatus => 1); $self->{typing_status} = 1; } }

I still get these repetitions even when I disable the KeyPress binding and the repeat timer. Again, this doesn't happen outside of my Tk app.

TIA,
Bill


In reply to Re: Re: Weirdness with Tk::Text by batkins
in thread Weirdness with Tk::Text by batkins

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.