Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Is there a way to make text boxes accept letters only? I've looked through the documentation but I'm not seeing it anywhere.
The WidgetTextBox sample shows how to accept or reject characters with a function:
// Show how to allow only 0-9, '-' and '.' in a textbox.
textBoxs->onChar( & WidgetTest1::acceptOnlyNumeric );
// Discard all chars except 0-9, '-' and '.'
// out: true if char was handled; ie that the system does not need to handle it further.
bool acceptOnlyNumeric( WidgetTextBoxPtr textField, int keychar )
if ( isdigit( keychar ) ) return false; // Accept 0-9
switch ( keychar )
case '.' :
case '-' :
case VK_LEFT :
case VK_RIGHT :
case VK_BACK :
return false; // Let control handle character
return true; // Throw the char away.
Thanks! I had looked at the WidgetTextBox example and didn't see anything like this, but after your reply I realized that I have the SmartWin 1.01 Dev-CPP package installed and not 2.0.