post WM_CLOSE instead of deleting the inplace edit control (second incarnation of the patch 1394785)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-10-29 20:24:11 +00:00
parent 6256bfc859
commit 55f42db2fb

View File

@@ -1394,21 +1394,19 @@ bool wxListCtrl::EndEditLabel(bool cancel)
{ {
// m_textCtrl is not always ready, ie. in EVT_LIST_BEGIN_LABEL_EDIT // m_textCtrl is not always ready, ie. in EVT_LIST_BEGIN_LABEL_EDIT
HWND hwnd = ListView_GetEditControl(GetHwnd()); HWND hwnd = ListView_GetEditControl(GetHwnd());
bool b = (hwnd != NULL); if ( !hwnd )
if (b) return false;
{
if (cancel) if ( cancel )
::SetWindowText(hwnd, wxEmptyString); // dubious but better than nothing ::SetWindowText(hwnd, wxEmptyString); // dubious but better than nothing
if (m_textCtrl)
{ // we shouldn't destroy the control ourselves according to MSDN, which
m_textCtrl->UnsubclassWin(); // proposes WM_CANCELMODE to do this, but it doesn't seem to work
m_textCtrl->SetHWND(0); //
delete m_textCtrl; // posting WM_CLOSE to it does seem to work without any side effects
m_textCtrl = NULL; ::PostMessage(hwnd, WM_CLOSE, 0, 0);
}
::DestroyWindow(hwnd); return true;
}
return b;
} }
// Ensures this item is visible // Ensures this item is visible