From: Vadim Zeitlin Date: Sun, 4 Nov 2007 16:16:46 +0000 (+0000) Subject: only generate wxEVT_COMMAND_TEXT_ENTER if the combobox has wxTE_PROCESS_ENTER style... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/643c973bd80a90fcaf59340c2d0206b6be564f00 only generate wxEVT_COMMAND_TEXT_ENTER if the combobox has wxTE_PROCESS_ENTER style (for compatibility with wxMSW and wxTextCtrl); removed code using gtk_widget_activate() as this shouldn't be needed here at all git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49624 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 0caf6df81f..63a370d1cb 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -780,35 +780,25 @@ void wxComboBox::SetSelection( int n ) void wxComboBox::OnChar( wxKeyEvent &event ) { - if ( event.GetKeyCode() == WXK_RETURN ) + switch ( event.GetKeyCode() ) { - // GTK automatically selects an item if its in the list - wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId()); - eventEnter.SetString( GetValue() ); - eventEnter.SetInt( GetSelection() ); - eventEnter.SetEventObject( this ); - - if (!GetEventHandler()->ProcessEvent( eventEnter )) - { - // This will invoke the dialog default action, such - // as the clicking the default button. - - wxWindow *top_frame = m_parent; - while (top_frame->GetParent() && !(top_frame->IsTopLevel())) - top_frame = top_frame->GetParent(); - - if (top_frame && GTK_IS_WINDOW(top_frame->m_widget)) + case WXK_RETURN: + if ( HasFlag(wxTE_PROCESS_ENTER) ) { - GtkWindow *window = GTK_WINDOW(top_frame->m_widget); - - if (window->default_widget) - gtk_widget_activate (window->default_widget); + // GTK automatically selects an item if its in the list + wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId()); + eventEnter.SetString( GetValue() ); + eventEnter.SetInt( GetSelection() ); + eventEnter.SetEventObject( this ); + + if ( GetEventHandler()->ProcessEvent(eventEnter) ) + { + // Catch GTK event so that GTK doesn't open the drop + // down list upon RETURN. + return; + } } - } - - // Catch GTK event so that GTK doesn't open the drop - // down list upon RETURN. - return; + break; } event.Skip();