diff --git a/docs/changes.txt b/docs/changes.txt index 9d5383f7e3..d56c51c7c6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -204,6 +204,7 @@ wxMSW: - fix for explicit keyword detection (VC++) - fix for sending event from wxCheckListBox::Check() - wxCaret::SetSize correction for showing caret +- fix for wxTreeCtrl label editing in wxTR_MULTIPLE mode wxMotif: diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 6bafa07e1a..ed121b6e20 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2091,13 +2091,23 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) } else // normal click { - // clear the selection and then let the default handler - // do the job + // avoid doing anything if we click on the only + // currently selected item + wxArrayTreeItemIds selections; + size_t count = GetSelections(selections); + if ( count == 0 || + count > 1 || + HITEM(selections[0]) != htItem ) + { + // clear the previously selected items UnselectAll(); // prevent the click from starting in-place editing - // when there was no selection in the control + // which should only happen if we click on the + // already selected item (and nothing else is + // selected) TreeView_SelectItem(GetHwnd(), 0); + } // reset on any click without Shift m_htSelStart = 0;