Fixed (native) wxComboBox::SetSelection and

wxListBox/wxComboBox::GetString.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon 2003-03-16 20:40:35 +00:00
parent b1ef882100
commit d40708e2fd
2 changed files with 6 additions and 7 deletions

View File

@ -229,18 +229,17 @@ void wxComboBox::Clear()
void wxComboBox::SetSelection (int n) void wxComboBox::SetSelection (int n)
{ {
#ifdef LESSTIF_VERSION #if wxCHECK_LESSTIF()
XmListSelectPos (GetXmList(this), n + 1, false); XmListSelectPos (GetXmList(this), n + 1, false);
SetValue(GetString(n)); SetValue(GetString(n));
#else #else
#if 0
wxXmString str( GetString(n).c_str() ); wxXmString str( GetString(n).c_str() );
XmComboBoxSelectItem((Widget) m_mainWidget, str()); XmComboBoxSelectItem((Widget) m_mainWidget, str());
#if 0
// does it work for Motif
XtVaSetValues( (Widget)m_mainWidget,
XmNselectedPosition, n + 1,
NULL );
#endif #endif
XtVaSetValues( (Widget)m_mainWidget,
XmNselectedPosition, n,
NULL );
#endif #endif
} }

View File

@ -459,7 +459,7 @@ wxString wxDoGetStringInList( Widget listBox, int n )
XmNitemCount, &count, XmNitemCount, &count,
XmNitems, &strlist, XmNitems, &strlist,
NULL ); NULL );
if( n <= count && n >= 0 ) if( n < count && n >= 0 )
return wxXmStringToString( strlist[n] ); return wxXmStringToString( strlist[n] );
else else
return wxEmptyString; return wxEmptyString;