]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied [ 1394785 ] wxListCtrl::EndEditLabel implementation
authorJulian Smart <julian@anthemion.co.uk>
Sat, 11 Feb 2006 15:16:35 +0000 (15:16 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sat, 11 Feb 2006 15:16:35 +0000 (15:16 +0000)
By troelsk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index 7a365c7a0e94eb9bb43aa49f28376243f08a9a6e..9efd6f226b6fea96546d9d10df74db2ad30dbe9c 100644 (file)
@@ -1372,11 +1372,25 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
 }
 
 // End label editing, optionally cancelling the edit
-bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel))
+bool wxListCtrl::EndEditLabel(bool cancel)
 {
-    wxFAIL_MSG( _T("not implemented") );
-
-    return false;
+    // m_textCtrl is not always ready, ie. in EVT_LIST_BEGIN_LABEL_EDIT
+    HWND hwnd = ListView_GetEditControl(GetHwnd());
+    bool b = (hwnd != NULL);
+    if (b)
+    {
+        if (cancel)
+            ::SetWindowText(hwnd, wxEmptyString); // dubious but better than nothing
+        if (m_textCtrl)
+        {
+            m_textCtrl->UnsubclassWin();
+            m_textCtrl->SetHWND(0);
+            delete m_textCtrl;
+            m_textCtrl = NULL;
+        }
+        ::DestroyWindow(hwnd);
+    }
+    return b;
 }
 
 // Ensures this item is visible