]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't generate duplicated events for clicks on tree +/- buttons.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Aug 2009 17:24:45 +0000 (17:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Aug 2009 17:24:45 +0000 (17:24 +0000)
In multiple selection mode we process mouse events manually in wxTreeCtrl
itself and already take care of mouse clicks on the buttons there so don't
pass them on to the base class which would generate another event.

Closes #11098 (thanks to Jonathan Liu).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/treectrl.cpp

index 776740fa1cce13db836d7940b397a3b470df1aac..f90ba117d3b6856ad8facc0815733dafd1c83b10 100644 (file)
@@ -2717,9 +2717,17 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
 
                 if ( !(tvht.flags & TVHT_ONITEM) )
                 {
-                    if ( !HandleMouseEvent(nMsg, x, y, wParam) )
+                    if ( tvht.flags & TVHT_ONITEMBUTTON )
                     {
-                        if ( tvht.flags & TVHT_ONITEMBUTTON )
+                        // either it's going to be handled by user code or
+                        // we're going to use it ourselves to toggle the
+                        // branch, in either case don't pass it to the base
+                        // class which would generate another mouse click event
+                        // for it even though it's already handled here
+                        processed = true;
+                        SetFocus();
+
+                        if ( !HandleMouseEvent(nMsg, x, y, wParam) )
                         {
                             if ( !IsExpanded(htItem) )
                             {
@@ -2730,8 +2738,6 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
                                 Collapse(htItem);
                             }
                         }
-
-                        processed = true;
                     }
 
                     m_focusLost = false;