From: Vadim Zeitlin Date: Thu, 2 Jan 2003 20:21:41 +0000 (+0000) Subject: fixed bug with wxTR_EDIT_LABELS not working with xwTR_MULTIPLE (bug 622089) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/df4ac4c7e93cfc6a6253331285c0f8a50b0e22b2 fixed bug with wxTR_EDIT_LABELS not working with xwTR_MULTIPLE (bug 622089) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 02352e56f8..17d24adda7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -26,6 +26,7 @@ wxMSW: - support for accelerator keys in the owner drawn menus (Derry Bryson) - wxCaret::SetSize() doesn't hide the caret any longer as it used to - wxCheckListBox::Check() doesn't send CHECKLISTBOX_TOGGLE event any more +- fixed bug with wxTR_EDIT_LABELS not workign with wxTR_MULTIPLE All: diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 8727b16fa1..f8e18e26d0 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2092,13 +2092,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 - UnselectAll(); - - // prevent the click from starting in-place editing - // when there was no selection in the control - TreeView_SelectItem(GetHwnd(), 0); + // 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 + // 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;