]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/textctrl.cpp
Updated to new PyCrust
[wxWidgets.git] / src / mac / carbon / textctrl.cpp
index 69da2912c7daa85033ac7e96be0cfb1952891271..c6a6d86e092aec816ccd0c601333fc1677a232e1 100644 (file)
 #pragma implementation "textctrl.h"
 #endif
 
+#include "wx/defs.h"
+
+#if wxUSE_TEXTCTRL
+
 #ifdef __DARWIN__
   #include <sys/types.h>
   #include <sys/stat.h>
@@ -680,12 +684,15 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
                        }
                        if ( panel && panel->GetDefaultItem() )
                        {
-                               wxButton *def = panel->GetDefaultItem() ;
-                               wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
-                                       event.SetEventObject(def);
-                                       def->Command(event);
-                               event.Skip() ;
-                       return ;
+                    wxButton *def = wxDynamicCast(panel->GetDefaultItem(),
+                                                          wxButton);
+                               if ( def && def->IsEnabled() )
+                               {
+                                   wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                                           event.SetEventObject(def);
+                                           def->Command(event);
+                       return ;
+                   }
                        }
             }
             //else: multiline controls need Enter for themselves
@@ -781,3 +788,5 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
     event.Enable( CanRedo() );
 }
 
+#endif
+    // wxUSE_TEXTCTRL