in reply to Re^2: How to validate text in Text widge
in thread How to validate text in Text widge
#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit; my $tt = $mw->Scrolled('anonText', -bg => 'white' ); $tt->pack( qw/-expand 1 -fill both / ); $mw->geometry('50x100'); $mw->WidgetDump; use Tk::WidgetDump; $tt->focus; $mw->MainLoop; BEGIN { package Tk::anonText; use base qw/ Tk::Derived Tk::Text /; Construct Tk::Widget 'anonText'; sub Insert { warn "@_ "; my( $w, $string ) = @_; return unless (defined $string && $string ne ''); return if $string eq ';'; return $w->SUPER::Insert( $string ); } 1; } __END__
|
|---|