]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/classic/listbox.cpp
chain to the polling function GLib was using before we replaced it, eliminating all...
[wxWidgets.git] / src / mac / classic / listbox.cpp
index 613d60912c216609690f5996a19ab07afe171cc2..d0de7211908e92d497b629330f176f01ea67a927 100644 (file)
@@ -924,14 +924,10 @@ void wxListBox::OnChar(wxKeyEvent& event)
 {
     if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
     {
-        wxWindow* parent = GetParent() ;
-        while( parent  && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
-            parent = parent->GetParent() ;
-
-        if ( parent && parent->GetDefaultItem() )
+        wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+        if ( tlw && tlw->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() );