]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/listbox.cpp
Include missing.h
[wxWidgets.git] / src / mac / listbox.cpp
index 656a835b6e0ebbeef39cf02647df78a62d458024..0cc15e774f43ae8f9520207ca96ce844837638b1 100644 (file)
@@ -221,7 +221,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     Str255 fontName ;
     SInt16 fontSize ;
     Style fontStyle ;
-    SInt16 fontNum ;
 #if TARGET_CARBON
     GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
 #else
@@ -925,10 +924,14 @@ void wxListBox::OnChar(wxKeyEvent& event)
     /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
     else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
     {
+       // FIXME: look in ancestors, not just parent.
         wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
-        wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
-        new_event.SetEventObject( win );
-        win->GetEventHandler()->ProcessEvent( new_event );
+        if (win)
+        {
+               wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
+               new_event.SetEventObject( win );
+               win->GetEventHandler()->ProcessEvent( new_event );
+       }
     }
     else if ( event.GetKeyCode() == WXK_TAB )
     {