a clipboard open.)" error when using wxTextCtrl::Replace
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11223
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0);
// Now replace with 'value', by pasting.
SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0);
// Now replace with 'value', by pasting.
- wxSetClipboardData(wxDF_TEXT, (wxObject *) (const wxChar *)value, 0, 0);
+ if (wxOpenClipboard()) {
+ wxSetClipboardData(wxDF_TEXT, (wxObject *) (const wxChar *)value, 0, 0);
+ wxCloseClipboard();
- // Paste into edit control
- SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
+ // Paste into edit control
+ SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L);
+ }
#else
wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0.");
#endif
#else
wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0.");
#endif