end label editing if the control loses focus (slightly modified patch 1084592)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-12-20 01:23:52 +00:00
parent ca1ecff429
commit d35dce3a2e
2 changed files with 28 additions and 2 deletions

View File

@@ -2053,7 +2053,7 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item,
}
// End label editing, optionally cancelling the edit
void wxTreeCtrl::EndEditLabel(const wxTreeItemId& WXUNUSED(item), bool discardChanges)
void wxTreeCtrl::DoEndEditLabel(bool discardChanges)
{
TreeView_EndEditLabelNow(GetHwnd(), discardChanges);
@@ -2476,6 +2476,24 @@ WXLRESULT wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara
processed = true;
}
}
else if ( nMsg == WM_COMMAND )
{
// if we receive a EN_KILLFOCUS command from the in-place edit control
// used for label editing, make sure to end editing
WORD id, cmd;
WXHWND hwnd;
UnpackCommand(wParam, lParam, &id, &hwnd, &cmd);
if ( cmd == EN_KILLFOCUS )
{
if ( m_textCtrl && m_textCtrl->GetHandle() == hwnd )
{
DoEndEditLabel();
processed = true;
}
}
}
if ( !processed )
rc = wxControl::MSWWindowProc(nMsg, wParam, lParam);