X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e409b62aaf6b333803027645ecc77de6c92cae2d..70fc30ae82d974d2e6710583cc1d34b98c4b3c5f:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index a0301aec4a..f90acc0439 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1394,21 +1394,19 @@ bool wxListCtrl::EndEditLabel(bool cancel) { // 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; + if ( !hwnd ) + return false; + + if ( cancel ) + ::SetWindowText(hwnd, wxEmptyString); // dubious but better than nothing + + // we shouldn't destroy the control ourselves according to MSDN, which + // proposes WM_CANCELMODE to do this, but it doesn't seem to work + // + // posting WM_CLOSE to it does seem to work without any side effects + ::PostMessage(hwnd, WM_CLOSE, 0, 0); + + return true; } // Ensures this item is visible