]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/textctrl.cpp
reverted the move of wxComboBox styles from wx/defs.h to wx/combobox.h, a lot of...
[wxWidgets.git] / src / mac / carbon / textctrl.cpp
index 24f9fdf83ecd86bd6a06a6d63c8e76d9a123ae20..c84b8fa71497f3154454e628229fd43d8596c08b 100644 (file)
@@ -962,15 +962,10 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
 
             if ( !(m_windowStyle & wxTE_MULTILINE) )
             {
-                wxWindow *parent = GetParent();
-                while ( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
+                wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+                if ( tlw && tlw->GetDefaultItem() )
                 {
-                    parent = parent->GetParent() ;
-                }
-
-                if ( parent && parent->GetDefaultItem() )
-                {
-                    wxButton *def = wxDynamicCast(parent->GetDefaultItem(), wxButton);
+                    wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
                     if ( def && def->IsEnabled() )
                     {
                         wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );