From a46cc43fedd1244716b29ada29c3677bedb5162d Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 13 Oct 2002 21:03:47 +0000 Subject: [PATCH] Combox gets its own SetFocus() wxDialog() set the focus to itself when shown. This will the propagate to some control in the dialog. I am not sure if this will override preceding user's call to SetFocus() in one of the child windows. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/combobox.cpp | 11 +++++++++++ src/gtk/dialog.cpp | 4 +++- src/gtk/menu.cpp | 2 +- src/gtk1/combobox.cpp | 11 +++++++++++ src/gtk1/dialog.cpp | 4 +++- src/gtk1/menu.cpp | 2 +- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index a03df573b1..986b3279b7 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -209,6 +209,17 @@ wxComboBox::~wxComboBox() m_clientDataList.Clear(); } +void wxComboBox::SetFocus() +{ + if ( m_hasFocus ) + { + // don't do anything if we already have focus + return; + } + + gtk_widget_grab_focus( m_focusWidget ); +} + void wxComboBox::AppendCommon( const wxString &item ) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 474b60b633..4c95d23682 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -207,9 +207,11 @@ int wxDialog::ShowModal() } wxBusyCursorSuspender cs; // temporarily suppress the busy cursor - + Show( TRUE ); + SetFocus(); + m_modalShowing = TRUE; g_openDialogs++; diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 24b1885cee..ba4b2a14da 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -1313,7 +1313,7 @@ static wxString GetHotKey( const wxMenuItem& item ) default: if ( code < 127 ) { - gchar *name = gdk_keyval_name((guint)code); + wxString name = wxGTK_CONV_BACK( gdk_keyval_name((guint)code) ); if ( name ) { hotkey << name; diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index a03df573b1..986b3279b7 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -209,6 +209,17 @@ wxComboBox::~wxComboBox() m_clientDataList.Clear(); } +void wxComboBox::SetFocus() +{ + if ( m_hasFocus ) + { + // don't do anything if we already have focus + return; + } + + gtk_widget_grab_focus( m_focusWidget ); +} + void wxComboBox::AppendCommon( const wxString &item ) { wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 474b60b633..4c95d23682 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -207,9 +207,11 @@ int wxDialog::ShowModal() } wxBusyCursorSuspender cs; // temporarily suppress the busy cursor - + Show( TRUE ); + SetFocus(); + m_modalShowing = TRUE; g_openDialogs++; diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 24b1885cee..ba4b2a14da 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -1313,7 +1313,7 @@ static wxString GetHotKey( const wxMenuItem& item ) default: if ( code < 127 ) { - gchar *name = gdk_keyval_name((guint)code); + wxString name = wxGTK_CONV_BACK( gdk_keyval_name((guint)code) ); if ( name ) { hotkey << name;