Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Tk question about Text widget

by Courage (Parson)
on Jun 08, 2002 at 12:04 UTC ( [id://172767]=perlquestion: print w/replies, xml ) Need Help??

Courage has asked for the wisdom of the Perl Monks concerning the following question:

Dear wise fellows perlmonks!

How can one intercept changing of cursor position in Text widget?
Is there a way to do this without intercepting of all events and comparing old and new position?

Thanks in advance,
Courage, the Cowardly Dog.
PS. Something fishy is going on there, or my name is Vadim Konovalov. And it's not.

Replies are listed 'Best First'.
Re: Tk question about Text widget
by Courage (Parson) on Jun 08, 2002 at 14:11 UTC
    After some experiments and Text.pm reading I found out a way to do this
    Seems like "good" way of doing this is unimplemented (so question is still remains, whether exists this "good" way), but there is "not such bad" way.

    In my widget, which is derived from Tk::Text, I redefined a function SetCursor, and all worked!

    sub SetCursor { my $w = shift; print STDERR "here we know that cursor position changed\n"; my $rc = $w->SUPER::SetCursor(@_); print STDERR "do something more when Text widget calmed down after c +hanging cursor position\n"; return $rc; }
    Works okay, any cursor changes are reported.
    Blessed OOP in Tk!

    Also, many other intresting event mappings could be done this way.

    Courage, the Cowardly Dog.
    PS. Something fishy is going on there, or my name is Vadim Konovalov. And it's not.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://172767]
Approved by virtualsue
Front-paged by ariels
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found