]> git.saurik.com Git - wxWidgets.git/commitdiff
Test for result of searching for wxID_CANCEL button
authorJulian Smart <julian@anthemion.co.uk>
Sun, 13 Apr 2003 22:56:09 +0000 (22:56 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 13 Apr 2003 22:56:09 +0000 (22:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20207 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/listbox.cpp
src/mac/listbox.cpp

index 656a835b6e0ebbeef39cf02647df78a62d458024..87757f78e229fd29a302163989844c9de0cde8f5 100644 (file)
@@ -925,10 +925,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 )
     {
index 656a835b6e0ebbeef39cf02647df78a62d458024..87757f78e229fd29a302163989844c9de0cde8f5 100644 (file)
@@ -925,10 +925,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 )
     {