diff --git a/docs/changes.txt b/docs/changes.txt index 1d55b3df2d..690b17f601 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -157,6 +157,7 @@ wxMSW: - Fix unexpected change in MDI children order after showing a file dialog. - Don't send events for already selected radio popup menu items (Kinaou Hervé). - wxListCtrl::GetItemCount() in wxEVT_LIST_INSERT_ITEM is no longer off by 1. +- Don't send bogus root selection events when clicking wxTreeCtrl (sbrowne). wxOSX/Cocoa: diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 038293121e..b6f9789aad 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -3477,7 +3477,14 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // to avoid such surprises, we force the generation of focus events // now, before we generate the selection change ones if ( !m_changingSelection && !m_isBeingDeleted ) + { + // Setting focus can generate selection events too however, + // suppress them as they're completely artificial and we'll + // generate the real ones soon. + TempSetter set(m_changingSelection); + SetFocus(); + } break; // instead of explicitly checking for _WIN32_IE, check if the