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
This commit is contained in:
Robert Roebling
2002-10-13 21:03:47 +00:00
parent 944b29b835
commit a46cc43fed
6 changed files with 30 additions and 4 deletions

View File

@@ -209,6 +209,17 @@ wxComboBox::~wxComboBox()
m_clientDataList.Clear(); 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 ) void wxComboBox::AppendCommon( const wxString &item )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );

View File

@@ -207,9 +207,11 @@ int wxDialog::ShowModal()
} }
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
Show( TRUE ); Show( TRUE );
SetFocus();
m_modalShowing = TRUE; m_modalShowing = TRUE;
g_openDialogs++; g_openDialogs++;

View File

@@ -1313,7 +1313,7 @@ static wxString GetHotKey( const wxMenuItem& item )
default: default:
if ( code < 127 ) if ( code < 127 )
{ {
gchar *name = gdk_keyval_name((guint)code); wxString name = wxGTK_CONV_BACK( gdk_keyval_name((guint)code) );
if ( name ) if ( name )
{ {
hotkey << name; hotkey << name;

View File

@@ -209,6 +209,17 @@ wxComboBox::~wxComboBox()
m_clientDataList.Clear(); 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 ) void wxComboBox::AppendCommon( const wxString &item )
{ {
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") ); wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );

View File

@@ -207,9 +207,11 @@ int wxDialog::ShowModal()
} }
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
Show( TRUE ); Show( TRUE );
SetFocus();
m_modalShowing = TRUE; m_modalShowing = TRUE;
g_openDialogs++; g_openDialogs++;

View File

@@ -1313,7 +1313,7 @@ static wxString GetHotKey( const wxMenuItem& item )
default: default:
if ( code < 127 ) if ( code < 127 )
{ {
gchar *name = gdk_keyval_name((guint)code); wxString name = wxGTK_CONV_BACK( gdk_keyval_name((guint)code) );
if ( name ) if ( name )
{ {
hotkey << name; hotkey << name;