Add wxTextEntry::ForceUpper()
Allow automatically converting lower-case letters entered into wxTextCtrl to upper-case equivalents. Provide generic fallback and implement the method natively for all the major platforms. Also update the text sample to show it in action.
This commit is contained in:
@@ -898,7 +898,7 @@ void wxTextEntry::SetEditable(bool editable)
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// max length
|
||||
// input restrictions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxTextEntry::SetMaxLength(unsigned long len)
|
||||
@@ -913,6 +913,15 @@ void wxTextEntry::SetMaxLength(unsigned long len)
|
||||
::SendMessage(GetEditHwnd(), EM_LIMITTEXT, len, 0);
|
||||
}
|
||||
|
||||
void wxTextEntry::ForceUpper()
|
||||
{
|
||||
ConvertToUpperCase();
|
||||
|
||||
const HWND hwnd = GetEditHwnd();
|
||||
const LONG styleOld = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||
::SetWindowLong(hwnd, GWL_STYLE, styleOld | ES_UPPERCASE);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// hints
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user