Hi Johan,

Thanks for your response.

I've changed the title to reflect our conversation more accurately.

I have used the default one for simple one character validation for numeric
and for time input ('\d|\:'):

        if ($loc_validation_string ne "") {
            my $loc_numval = Wx::Perl::TextValidator->new(
$loc_validation_string );       # Set validation string
            $$loc_self_ptr->SetValidator( $loc_numval );
# Set validation
        }       

Where $loc_self_ptr is a pointer to control passed by reference.

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?

Sorry for being a bit slow here, but maybe you, or someone else, has an
example perl validator.  Eg for a time validation or a table lookup?  So
that I could use it as a template.

Thanks for your help.

Regards

Steve


-----Original Message-----
From: Johan Vromans [mailto:jvrom...@squirrel.nl] 
Sent: 16 August 2009 05:26
To: wxperl-users@perl.org
Subject: Re: wxGlade Generated Code

"Steve Cookson" <steve.cook...@sca-uk.com> writes:

> I have looked at them, but I didn't totally understand how they work.
> I'm using them for integer entry and time entry, but field lookup,
> I'm not clear what I should do.  Do you think I can use the validators
> for lookup?

The validator's Validate method is supposed to return true or false
depening on the data being correct. How it finds out validity is up to
you...

Note that you need Wx::PlValidator as base class.

-- Johan

Reply via email to