EVT_SET_FOCUS(wxTextCtrl::OnSetFocus)
END_EVENT_TABLE()
+// ----------------------------------------------------------------------------
+// function prototypes
+// ----------------------------------------------------------------------------
+
+LRESULT APIENTRY _EXPORT wxTextCtrlWndProc(HWND hWnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam);
+
+// ---------------------------------------------------------------------------
+// global vars
+// ---------------------------------------------------------------------------
+
+// the pointer to standard text control wnd proc
+static WNDPROC gs_wndprocEdit = (WNDPROC)NULL;
+
// ============================================================================
// implementation
// ============================================================================
+// ----------------------------------------------------------------------------
+// wnd proc for subclassed edit control
+// ----------------------------------------------------------------------------
+
+LRESULT APIENTRY _EXPORT wxTextCtrlWndProc(HWND hWnd,
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ wxWindow *win = wxFindWinFromHandle((WXHWND)hWnd);
+
+ switch ( message )
+ {
+ case WM_CUT:
+ case WM_COPY:
+ case WM_PASTE:
+ if( win->HandleClipboardEvent( message ) )
+ return 0;
+ break;
+ }
+ return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam);
+}
+
// ----------------------------------------------------------------------------
// creation
// ----------------------------------------------------------------------------
}
#endif // wxUSE_RICHEDIT
+ gs_wndprocEdit = wxSetWindowProc((HWND)GetHwnd(),
+ wxTextCtrlWndProc);
+
return true;
}
{
DoWriteText(value, false /* not selection only */);
+ // mark the control as being not dirty - we changed its text, not the
+ // user
+ DiscardEdits();
+
// for compatibility, don't move the cursor when doing SetValue()
SetInsertionPoint(0);
}
else // same text
{
+ // still reset the modified flag even if the value didn't really change
+ // because now it comes from the program and not the user (and do it
+ // before generating the event so that the event handler could get the
+ // expected value from IsModified())
+ DiscardEdits();
+
// still send an event for consistency
SendUpdateEvent();
}
-
- // we should reset the modified flag even if the value didn't really change
-
- // mark the control as being not dirty - we changed its text, not the
- // user
- DiscardEdits();
}
#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU)