reset m_textCtrl after finishing editing a label (part of patch 639394)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1280,8 +1280,15 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
|
|||||||
|
|
||||||
// ListView_EditLabel requires that the list has focus.
|
// ListView_EditLabel requires that the list has focus.
|
||||||
SetFocus();
|
SetFocus();
|
||||||
WXHWND hWnd = (WXHWND) ListView_EditLabel(GetHwnd(), item);
|
|
||||||
|
|
||||||
|
WXHWND hWnd = (WXHWND) ListView_EditLabel(GetHwnd(), item);
|
||||||
|
if ( !hWnd )
|
||||||
|
{
|
||||||
|
// failed to start editing
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// [re]create the text control wrapping the HWND we got
|
||||||
if ( m_textCtrl )
|
if ( m_textCtrl )
|
||||||
{
|
{
|
||||||
m_textCtrl->SetHWND(0);
|
m_textCtrl->SetHWND(0);
|
||||||
@@ -2124,6 +2131,17 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
// logic here is inversed compared to all the other messages
|
// logic here is inversed compared to all the other messages
|
||||||
*result = event.IsAllowed();
|
*result = event.IsAllowed();
|
||||||
|
|
||||||
|
// don't keep a stale wxTextCtrl around
|
||||||
|
if ( m_textCtrl )
|
||||||
|
{
|
||||||
|
// EDIT control will be deleted by the list control itself so
|
||||||
|
// prevent us from deleting it as well
|
||||||
|
m_textCtrl->SetHWND(0);
|
||||||
|
m_textCtrl->UnsubclassWin();
|
||||||
|
delete m_textCtrl;
|
||||||
|
m_textCtrl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user