Wx::Perl::TextValidator

From WxPerl wiki

Jump to: navigation, search

Wx::Perl::TextValidator

Perl replacement for wxTextValidator. Wx::Perl::TextValidator validates text controls, providing a variety of filtering behaviours.

Contructor

new( $pattern ); new( $pattern, \$variable );

  • $pattern - Must be a regular expression matching a single-character string and is used to validate the field contents and user input (e.g. '\d', '[abcdef]', qr/[a-zA-Z]/)
  • \$variable - If present, is used in TransferDataToWindow/TransferDataFromWindow as the source/destination for the field's contents.
my $storage = 0;
my $validator1 = new Wx::Perl::TextValidator( '[abcdef]' );
my $validator2 = new Wx::Perl::TextValidator( '\d', \$storage );
my $textctrl1 = new Wx::TextCtrl( $parent, -1, "a", wxDefaultPosition, [300,300], 0, $validator1 );
my $textctrl2 = new Wx::TextCtrl( $parent, -1, "0", wxDefaultPosition, [300,300], 0, $validator2 );

See Also

CPAN page for Wx::Perl::TextValidator

Google AdSense