From 821f5da31488710c2fda5c4dabb06963c8d9b7eb Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Wed, 18 Feb 2015 17:13:52 +0000 Subject: [PATCH] Suppress sending spurious wxEVT_PG_SELECTED events. Don't send wxEVT_PG_SELECTED event when wxPG is ordered to unselect current property but no property is actually selected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/propgrid.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 877bc3151a..70434d6737 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -4378,8 +4378,12 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags ) // call wx event handler (here so that it also occurs on deselection) // In case of deselection previously selected property // is passed to the event object. - if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) ) - SendEvent( wxEVT_PG_SELECTED, p? p: prevFirstSel, NULL ); + if (!p) + { + p = prevFirstSel; + } + if ( !(flags & wxPG_SEL_DONT_SEND_EVENT) && p) + SendEvent( wxEVT_PG_SELECTED, p, NULL ); return true; }