in reply to Onchange-like event handler for Tk text widget
Update: Please ignore - <<Modified>> works as advertised...
There seems to be a bug on Win32 which keeps <<Modified>> from being generated in case of a Ctrl-V paste. Here is another way to trigger on modifications:
Cheers, Christophuse warnings; use strict; use Tk; my $mw = tkinit; $mw->Text; my $insert = \&Tk::Text::insert; *Tk::Text::insert = sub{changed($_[0]); $insert->(@_); }; my $t = $mw->Text->pack; #$t->bind('<<Modified>>',sub{print shift," changed\n"}); MainLoop; sub changed{ print "$_[0] changed\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Onchange-like event handler for Tk text widget
by vkon (Curate) on Apr 12, 2011 at 07:29 UTC | |
by lamprecht (Friar) on Apr 12, 2011 at 10:52 UTC | |
by Lodae00 (Initiate) on Apr 12, 2011 at 08:16 UTC |