]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Vain attempts to make kbd navigation work inside find/replace dialog - it
[wxWidgets.git] / src / msw / textctrl.cpp
index caa8d82fe0bf23e8640ba183ba27e9e333966397..e83cf09c9aa4c8b19fcd99c1a9b09a4b0f8cc2fc 100644 (file)
@@ -690,10 +690,13 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
     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