Hi Steve,

[Quoting Steve Cookson, on August 16 2009, 09:25, in "Perl Validators"]
> I have used the default one for simple one character validation for numeric
> and for time input ('\d|\:'):
> [...]
> But I don't think I can extend this to whole strings like a time string
> (^([0-1][0-9]|2[0123])[:]([0-5][0-9])$).  Or maybe I can?

No. You are using a Wx::Perl::TextValidator, that validates single
character input only.

Wx::PlValidator is a base class to define your own validators that can
do anything you want.

See e.g., http://wxperl.pvoice.org/w/index.php/Wx::Validator .

Note, however, that validators can be fooled when pasting invalid
characters in the field.

I have some text field classes derived from Wx::TextCtrl that check
input upon each keystroke and could serve as an example.

-- Johan

Reply via email to