]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/html/test/test.cpp
add unit test for wxTextCtrl::SetSelection()
[wxWidgets.git] / samples / html / test / test.cpp
index 59b006e2bbb17eaf768f9549b1de7274ef4c7848..176bc81b428f4c33e15e96df15cbf22cd4688565 100644 (file)
@@ -358,7 +358,7 @@ void MyHtmlWindow::OnClipboardEvent(wxClipboardTextEvent& WXUNUSED(event))
     if ( CopySelection() )
     {
         wxTextDataObject data;
-        if ( wxTheClipboard && wxTheClipboard->GetData(data) )
+        if ( wxTheClipboard && wxTheClipboard->Open() && wxTheClipboard->GetData(data) )
         {
             const wxString text = data.GetText();
             const size_t maxTextLength = 100;
@@ -367,6 +367,8 @@ void MyHtmlWindow::OnClipboardEvent(wxClipboardTextEvent& WXUNUSED(event))
                         wxString(text, maxTextLength).c_str(),
                         (text.length() > maxTextLength) ? _T("...")
                                                         : _T("")));
+            wxTheClipboard->Close();
+
             return;
         }
     }