From 4496eadc93e3740f2e0d936cace2eb58ef2f3f63 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sat, 11 Feb 2006 15:16:35 +0000 Subject: [PATCH] Applied [ 1394785 ] wxListCtrl::EndEditLabel implementation By troelsk git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 7a365c7a0e..9efd6f226b 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -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 -- 2.45.2