TextValidator(3pm)

✨ NAME ✨

okay so bestie, gather round β€” this is TextValidator(3pm), aka Wx::Perl::TextValidator β€” it's literally a Perl replacement for wxTextValidator. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

my $storage = '';
my $validator1 = Wx::Perl::TextValidator->new( '\d', \$storage );
my $validator2 = Wx::Perl::TextValidator->new( '[abcdef]' );
my $validator3 = Wx::Perl::TextValidator->new( qr/[a-zA-Z]/ );

my $textctrl = Wx::TextCtrl->new( $parent, -1, "", $pos, $size, $style,
                                  $validator1 );

like… look at her. three whole validators, three whole regexes, one Wx::TextCtrl that actually listens to you. we love a functional friendship. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so Wx::Perl::TextValidator is a Wx::Validator subclass, and its whole job β€” her entire main character energy β€” is letting you filter user input to a Wx::TextCtrl. that's it. that's the gig. no cap. πŸ’–


πŸ’– METHODS πŸ’–

my $validator1 = Wx::Perl::TextValidator->new( $regexp, \$storage );
my $validator2 = Wx::Perl::TextValidator->new( $regexp );

she constructs a brand new Wx::Perl::Validator. iconic behavior.

  • the first argument has to be a regular expression that matches a single-character string, and it's the thing doing the actual work β€” validating the field contents and the user input. yes bestie, every keystroke is getting vibe checked. ⭐
  • the second argument, if you even bother to pass it, gets used in TransferDataToWindow/TransferDataToWindow as the source/destination for the field's contents. it's the little storage goblin behind the scenes. πŸŽ€
fyi, the first argument can be a plain old string as well as a regular expression object made using qr//. so you have options. she's flexible like that. πŸ’œ

and that's the whole page, bestie β€” perl v5.42.3, dated 2026-08-20, straight outta the User Contributed Perl Documentation. go forth and validate, you gorgeous regex-wielding icon. πŸ‘‘βœ¨

πŸ“¦ where this page comes from