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
This commit is contained in:
@@ -780,35 +780,25 @@ void wxComboBox::SetSelection( int n )
|
|||||||
|
|
||||||
void wxComboBox::OnChar( wxKeyEvent &event )
|
void wxComboBox::OnChar( wxKeyEvent &event )
|
||||||
{
|
{
|
||||||
if ( event.GetKeyCode() == WXK_RETURN )
|
switch ( event.GetKeyCode() )
|
||||||
{
|
{
|
||||||
// GTK automatically selects an item if its in the list
|
case WXK_RETURN:
|
||||||
wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
|
if ( HasFlag(wxTE_PROCESS_ENTER) )
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
GtkWindow *window = GTK_WINDOW(top_frame->m_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 (window->default_widget)
|
if ( GetEventHandler()->ProcessEvent(eventEnter) )
|
||||||
gtk_widget_activate (window->default_widget);
|
{
|
||||||
|
// Catch GTK event so that GTK doesn't open the drop
|
||||||
|
// down list upon RETURN.
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
// Catch GTK event so that GTK doesn't open the drop
|
|
||||||
// down list upon RETURN.
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
Reference in New Issue
Block a user