X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7205570233ce8420b71fa5df368054c8953ff0e4..e7ca6139d062c37cc7c056b6647097e999b714cd:/src/mac/button.cpp

diff --git a/src/mac/button.cpp b/src/mac/button.cpp
index 19600ac5d7..83cdba79e0 100644
--- a/src/mac/button.cpp
+++ b/src/mac/button.cpp
@@ -50,12 +50,11 @@ void wxButton::SetDefault()
 {
     wxWindow *parent = GetParent();
     wxButton *btnOldDefault = NULL;
-    wxPanel *panel = wxDynamicCast(parent, wxPanel);
-    if ( panel )
+    if ( parent )
     {
-        btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
+        btnOldDefault = wxDynamicCast(parent->GetDefaultItem(),
            wxButton);
-        panel->SetDefaultItem(this);
+        parent->SetDefaultItem(this);
     }
 
 	Boolean inData;
@@ -108,8 +107,11 @@ void wxButton::Command (wxCommandEvent & event)
 
 void wxButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) 
 {
+  if ( controlpart != kControlNoPart )
+  {
     wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId );
     event.SetEventObject(this);
     ProcessCommand(event);
+  }
 }