Actually, I rescind some of my comments about the Validator demo.
Turns out the Validate of the TextObjectValidator is called when the
'Okay' button on a dialog is pressed. However, I still don't
understand when a Validator's methods are called exactly.
C.D.
···
On Thu, 24 Feb 2005 11:43:42 -0500, Count Down <lifton.liftoff@gmail.com> wrote:
Hi all,
I'm trying to understand Validators in the context of wxPython. I've
been rummaging around the web without much success. I took a look at
the wxPython2.5 Validator demo. Here's what I found:1) A proper Validator needs to implement the Clone,
TransferFromWindow, TransferToWindow, and Validate methods.2) The Validator demo presents a subclass of PyValidator that
implements the Clone and Validate method, but not the other methods.3) The Validate method is never called by the demo. In particular,
all the work is being done by the OnChar method which is bound to
wx.EVT_CHAR.Given all the above, it seems the Validator demo does not demonstrate
Validators, but rather event catching. Am I missing something? It
would help me if someone could explain when and why each of the
required Validator methods is called in a real application.I've included the code for one of the sample Validators given in the
Validator demo below (I'm new to this list, so if this was
inappropriate, please let me know).
<snip>