How to get a validator to work in a frame

I guess the problem was that I was calling Validator on self and on
the input control, but never on panel. I don't understand why it
should be called on panel though, instead of the control itself. I
think the recursive flag only needs to be set if you call the method
on a parent control (such as self or panel, I guess), but I would
think it would work without the flag if called from the input control.

···

---------- Forwarded message ----------
From: "Werner F. Bruhin" <werner.bruhin@free.fr>
To: wxPython-users@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.

John Salerno wrote:

···

---------- Forwarded message ----------
From: "Werner F. Bruhin" <werner.bruhin@free.fr>
To: wxPython-users@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.

I guess the problem was that I was calling Validator on self and on
the input control, but never on panel. I don't understand why it
should be called on panel though, instead of the control itself. I
think the recursive flag only needs to be set if you call the method
on a parent control (such as self or panel, I guess), but I would
think it would work without the flag if called from the input control.

Because window.Validate is designed to be called on container windows to validate all the children of the window, and if the window has the wx.WS_EX_VALIDATE_RECURSIVELY extended style set then it also calls Validate of the child windows so that their children can be validated as well.

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!