in reply to Filtering/validating Tk::text input
#!/usr/bin/perl use warnings; use strict; use Tk; package Tk::MyText; require Tk::Text; use base qw/Tk::Text/; Construct Tk::Widget 'MyText'; sub ClassInit { # print "ClassInit [@_]\n"; my ( $class, $mw ) = @_; $class->SUPER::ClassInit( $mw ); return $class; } sub InsertKeypress { my ( $w, $char ) = @_; # print "@_\n"; if ( $char !~ /\d/ ) { return; } else { shift->SUPER::InsertKeypress( @_ ); } } 1; ############################################ package main; my $top = tkinit; my $text = $top->MyText->pack; MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Filtering/validating Tk::text input
by NatureFocus (Scribe) on Dec 06, 2006 at 19:50 UTC |