Added test for default action (button normally)
to combo box when hittinh return. In a normal Find&Replace dialog, hitting enter in one of the two fields will usually mean "OK". Corrected the same test in wxTextCtrl. Removed some debug code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -615,7 +615,26 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
//else: do nothing, this will open the listbox
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
|
||||
if (window->default_widget)
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -964,15 +964,22 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
||||
|
||||
if ((key_event.KeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
||||
{
|
||||
// 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();
|
||||
GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
|
||||
|
||||
if (window->default_widget)
|
||||
|
||||
if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
|
||||
|
||||
if (window->default_widget)
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1640,7 +1640,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
|
||||
g_focusWindowLast =
|
||||
g_focusWindow = win;
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
wxPrintf( "OnSetFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
wxPrintf( win->GetClassInfo()->GetClassName() );
|
||||
|
@@ -615,7 +615,26 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent( event );
|
||||
}
|
||||
//else: do nothing, this will open the listbox
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
|
||||
if (window->default_widget)
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -964,15 +964,22 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
|
||||
|
||||
if ((key_event.KeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
|
||||
{
|
||||
// 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();
|
||||
GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
|
||||
|
||||
if (window->default_widget)
|
||||
|
||||
if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
|
||||
|
||||
if (window->default_widget)
|
||||
{
|
||||
gtk_widget_activate (window->default_widget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1640,7 +1640,7 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
|
||||
g_focusWindowLast =
|
||||
g_focusWindow = win;
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
wxPrintf( "OnSetFocus from " );
|
||||
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
|
||||
wxPrintf( win->GetClassInfo()->GetClassName() );
|
||||
|
Reference in New Issue
Block a user