::SetWindowText(GetHwnd(), wxT(""));
}
+#ifdef __WIN32__
+
+bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event)
+{
+ SetFocus();
+
+ size_t lenOld = GetValue().length();
+
+ wxUint32 code = event.GetRawKeyCode();
+ ::keybd_event(code, 0, 0 /* key press */, NULL);
+ ::keybd_event(code, 0, KEYEVENTF_KEYUP, NULL);
+
+ // assume that any alphanumeric key changes the total number of characters
+ // in the control - this should work in 99% of cases
+ return GetValue().length() != lenOld;
+}
+
+#endif // __WIN32__
+
// ----------------------------------------------------------------------------
// Clipboard operations
// ----------------------------------------------------------------------------
long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
- // we always want the characters and the arrows
if ( nMsg == WM_GETDLGCODE )
{
// we always want the chars and the arrows
// we may have several different cases:
// 1. normal case: both TAB and ENTER are used for dialog navigation
- // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
- // control in the dialog
- // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
- // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
- // the next control
- if ( m_windowStyle & wxTE_PROCESS_ENTER )
+ // 2. ctrl which wants TAB for itself: ENTER is used to pass to the
+ // next control in the dialog
+ // 3. ctrl which wants ENTER for itself: TAB is used for dialog
+ // navigation
+ // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass
+ // to the next control
+
+ // the multiline edit control should always get <Return> for itself
+ if ( HasFlag(wxTE_PROCESS_ENTER) || HasFlag(wxTE_MULTILINE) )
lDlgCode |= DLGC_WANTMESSAGE;
- if ( m_windowStyle & wxTE_PROCESS_TAB )
+
+ if ( HasFlag(wxTE_PROCESS_TAB) )
lDlgCode |= DLGC_WANTTAB;
return lDlgCode;
::SetCursor(GetHcursorOf(wxCursor(wxCURSOR_HAND)));
*result = TRUE;
break;
-
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP: