[wxPython-users] How to get a validator to work in a frame

John Salerno johnjsal at gmail.com
Tue Aug 1 07:02:09 PDT 2006


>
> ---------- Forwarded message ----------
> From: Robin Dunn <robin at alldunn.com>
> To: wxPython-users at lists.wxwidgets.org
> Date: Mon, 31 Jul 2006 09:33:00 -0700
> Subject: Re: [wxPython-users] How to get a validator to work in a frame
> John Salerno wrote:
> >> ---------- Forwarded message ----------
> >> From: "Werner F. Bruhin" <werner.bruhin at free.fr>
> >> To: wxPython-users at lists.wxwidgets.org
> >> Date: Sat, 29 Jul 2006 09:05:31 +0200
> >> Subject: Re: [wxPython-users] How to get a validator to work in a frame
> >> Hi John,
> >>
> >> I got it to work, but frankly I don't understand why it did not work in
> >> the first place.
> >>
> >> Kept a reference to the panel, and then called validate on the panel.
> >> Ah, maybe that is the problem, maybe you need to use the
> >> "wxWS_EX_VALIDATE_RECURSIVELY" on your frame.
> >>
> >> Also noticed that the validator init is called twice but the cloned is
> >> only done once, again can't explain this.
> >>
> >> You still need to validate that user does not enter alpha characters.
> >>
> >> You might want to look at the masked controls, there is a IntCtrl and
> or
> >> MaskedNumCtrl (see the demo under More Windows/Controls).
> >>
> >> Changed version attached.
> >>
> >> Werner
> >
> > Thanks. I also tried to set the recursive flag and call Validate on
> > self (the frame), but that still didn't work. Your method works,
> > however, by calling it on the panel. But I don't understand either why
> > __init__ is called twice. The validator is created when the TextCtrl
> > is, but other than that I don't see when __init__ would get called
> > again.
>
> Probably when its Clone method is called.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>

Thanks. So is Clone called implicitly? There's no call for it, even if
that's the reason __init__ is called twice. Could I just use a pass
statement in the Clone body, or does it need functionality?

Also, do you know why it didn't work when I set the recursive flag and
called Validate on self?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200608=
01/56a93eef/attachment.htm


More information about the wxpython-users mailing list