Don't generate bogus root item selection events in wxMSW wxTreeCtrl.

Setting focus to the control when receiving a selection event can result in
another selection event being generated by the control itself if it hadn't had
any selection before, which is completely artificial, i.e. doesn't correspond
to any user action, and so has to be suppressed.

Closes #16999.
This commit is contained in:
Vadim Zeitlin
2015-06-01 00:40:26 +02:00
parent e78b57308f
commit 39b9a6bbeb
2 changed files with 8 additions and 0 deletions

View File

@@ -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