]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for clicking on the button from 2.2 branch
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 2 Apr 2001 12:23:54 +0000 (12:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 2 Apr 2001 12:23:54 +0000 (12:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9644 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treectlg.cpp

index e3f8fda4a26881dc7556f62b122d5e63ab771e58..61d3d2e8ab12e7bc1889aa8ca0aefc83b6f9a118 100644 (file)
@@ -2282,13 +2282,26 @@ void wxGenericTreeCtrl::Edit( const wxTreeItemId& item )
             m_imageListNormal->GetSize( image, image_w, image_h );
             image_w += 4;
         }
-        else
+        else // !RightDown() && !LeftUp() ==> LeftDown() || LeftDClick()
         {
             wxFAIL_MSG(_T("you must create an image list to use images!"));
         }
     }
     x += image_w;
     w -= image_w + 4; // I don't know why +4 is needed
+            if ( flags & wxTREE_HITTEST_ONITEMBUTTON )
+            {
+                // only toggle the item for a single click, double click on
+                // the button doesn't do anything (it toggles the item twice)
+                if ( event.LeftDown() )
+                {
+                    Toggle( item );
+                }
+
+                // don't select the item if the button was clicked
+                return;
+            }
+
 
     wxClientDC dc(this);
     PrepareDC( dc );
@@ -2489,13 +2502,6 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
                                 event.ControlDown(),
                                 is_multiple, extended_select, unselect_others);
 
-            if ( (flags & wxTREE_HITTEST_ONITEMBUTTON) && event.LeftDown() )
-            {
-                Toggle( item );
-                if ( is_multiple )
-                    return;
-            }
-
             SelectItem(item, unselect_others, extended_select);
 
             if ( event.LeftDClick() )