virtual BOOL ValidateString(const CString& sEdit);
sEdit
A reference to a CString which holds the text as it would appear in the cell when the key has been accepted.
Specifies whether the string is valid. If you return FALSE, the current operation will be canceled.
Called after the user has pressed a key and before it is accepted. Will also be called from OnValidate and from SetCurrentText before the text is displayed in the cell.
See the example for how you can tell a control to accept only digits.
This sample demonstrates how to tell a control that it should accept only digits:
BOOL CDigitOnlyEdit::ValidateString(const CString& sEdit)
{
// cycle through string and check each character if it is a digit
for (int n = 0; n < sEdit.GetLength(); n++)
{
if (!isdigit(sEdit[n]))
return FALSE;
}
return TRUE;
}
CGXControl::SetCurrentText CGXControl::OnInvalidKeyPressed CGXControl::OnValidate
Class Overview | Class Members