1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
<HTML>
<head><title>wxValidator</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxvalidator"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx254.htm#wxurl"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx256.htm#wxvariant"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxValidator</H2>
<P>
wxValidator is the base class for a family of validator classes that mediate
between a class of control, and application data.<P>
A validator has three major roles:<P>
<OL>
<LI> to transfer data from a C++ variable or own storage to and from a control;
<LI> to validate data in a control, and show an appropriate error message;
<LI> to filter events (such as keystrokes), thereby changing the behaviour of the
associated control.
</OL>
<P>
Validators can be plugged into controls dynamically.<P>
To specify a default, 'null' validator, use the symbol <B>wxDefaultValidator</B>.<P>
For more information, please see <A HREF="wx309.htm#validatoroverview">Validator overview</A>.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/validate.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx309.htm#validatoroverview">Validator overview</A>, <A HREF="wx244.htm#wxtextvalidator">wxTextValidator</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxvalidatorconstr">wxValidator::wxValidator</A><BR>
<A HREF="#topic1004">wxValidator::~wxValidator</A><BR>
<A HREF="#wxvalidatorclone">wxValidator::Clone</A><BR>
<A HREF="#wxvalidatorgetwindow">wxValidator::GetWindow</A><BR>
<A HREF="#topic1005">wxValidator::SetBellOnError</A><BR>
<A HREF="#wxvalidatorsetwindow">wxValidator::SetWindow</A><BR>
<A HREF="#wxvalidatortransferfromwindow">wxValidator::TransferFromWindow</A><BR>
<A HREF="#wxvalidatortransfertowindow">wxValidator::TransferToWindow</A><BR>
<A HREF="#wxvalidatorvalidate">wxValidator::Validate</A><BR>
<P>
<HR>
<A NAME="wxvalidatorconstr"></A>
<H3>wxValidator::wxValidator</H3>
<P>
<B></B> <B>wxValidator</B>()<P>
Constructor.<P>
<HR>
<A NAME="topic1004"></A>
<H3>wxValidator::~wxValidator</H3>
<P>
<B></B> <B>~wxValidator</B>()<P>
Destructor.<P>
<HR>
<A NAME="wxvalidatorclone"></A>
<H3>wxValidator::Clone</H3>
<P>
<B>virtual wxValidator*</B> <B>Clone</B>() <B>const</B><P>
All validator classes must implement the <B>Clone</B> function, which returns
an identical copy of itself. This is because validators are passed to control
constructors as references which must be copied. Unlike objects such as pens
and brushes, it does not make sense to have a reference counting scheme
to do this cloning, because all validators should have separate
data.<P>
This base function returns NULL.<P>
<HR>
<A NAME="wxvalidatorgetwindow"></A>
<H3>wxValidator::GetWindow</H3>
<P>
<B>wxWindow*</B> <B>GetWindow</B>() <B>const</B><P>
Returns the window associated with the validator.<P>
<HR>
<A NAME="topic1005"></A>
<H3>wxValidator::SetBellOnError</H3>
wxvalidatorsetbellonerror<P>
<B>void</B> <B>SetBellOnError</B>(<B>bool</B><I> doIt = TRUE</I>)<P>
This functions switches on or turns off the error sound produced by the
validators if an invalid key is pressed.<P>
<HR>
<A NAME="wxvalidatorsetwindow"></A>
<H3>wxValidator::SetWindow</H3>
<P>
<B>void</B> <B>SetWindow</B>(<B>wxWindow*</B><I> window</I>)<P>
Associates a window with the validator.<P>
<HR>
<A NAME="wxvalidatortransferfromwindow"></A>
<H3>wxValidator::TransferFromWindow</H3>
<P>
<B>virtual bool</B> <B>TransferToWindow</B>(<B>wxWindow*</B><I> parent</I>)<P>
This overridable function is called when the value in the window must be
transferred to the validator. Return FALSE if there is a problem.<P>
<HR>
<A NAME="wxvalidatortransfertowindow"></A>
<H3>wxValidator::TransferToWindow</H3>
<P>
<B>virtual bool</B> <B>TransferToWindow</B>(<B>wxWindow*</B><I> parent</I>)<P>
This overridable function is called when the value associated with the validator must be
transferred to the window. Return FALSE if there is a problem.<P>
<HR>
<A NAME="wxvalidatorvalidate"></A>
<H3>wxValidator::Validate</H3>
<P>
<B>virtual bool</B> <B>Validate</B>(<B>wxWindow*</B><I> parent</I>)<P>
This overridable function is called when the value in the associated window must be validated.
Return FALSE if the value in the window is not valid; you may pop up an error dialog.<P>
</BODY></HTML>
|