// edited simultaneously)
wxTextCtrl* GetEditControl() const;
// end editing and accept or discard the changes to item label
- void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false);
+ void EndEditLabel(const wxTreeItemId& WXUNUSED(item),
+ bool discardChanges = false)
+ {
+ DoEndEditLabel(discardChanges);
+ }
// sorting
// this function is called to compare 2 items and should return -1, 0
// refresh a single item
void RefreshItem(const wxTreeItemId& item);
+ // end edit label
+ void DoEndEditLabel(bool discardChanges = false);
+
+
// data used only while editing the item label:
wxTextCtrl *m_textCtrl; // text control in which it is edited
wxTreeItemId m_idEdited; // the item being edited
}
// 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);
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);