]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed (native) wxComboBox::SetSelection and
authorMattia Barbon <mbarbon@cpan.org>
Sun, 16 Mar 2003 20:40:35 +0000 (20:40 +0000)
committerMattia Barbon <mbarbon@cpan.org>
Sun, 16 Mar 2003 20:40:35 +0000 (20:40 +0000)
wxListBox/wxComboBox::GetString.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/motif/combobox_native.cpp
src/motif/listbox.cpp

index 9a96177941235273f2793c1e81c024bec259cea1..498ce2565f37d27608a46770bb6c276846043828 100644 (file)
@@ -229,19 +229,18 @@ void wxComboBox::Clear()
 
 void wxComboBox::SetSelection (int n)
 {
-#ifdef LESSTIF_VERSION
+#if wxCHECK_LESSTIF()
     XmListSelectPos (GetXmList(this), n + 1, false);
     SetValue(GetString(n));
 #else
+#if 0
     wxXmString str( GetString(n).c_str() );
     XmComboBoxSelectItem((Widget) m_mainWidget, str());
-#if 0
-    // does it work for Motif
+#endif
     XtVaSetValues( (Widget)m_mainWidget,
-                   XmNselectedPosition, n + 1,
+                   XmNselectedPosition, n,
                    NULL );
 #endif
-#endif
 }
 
 int wxComboBox::GetSelection (void) const
index dc8cf4c10a832ad62891f99546fa5b00c2406abc..db682d40d422c5c0c7def309abd5f91d0c9021ad 100644 (file)
@@ -459,7 +459,7 @@ wxString wxDoGetStringInList( Widget listBox, int n )
                    XmNitemCount, &count,
                    XmNitems, &strlist,
                    NULL );
-    if( n <= count && n >= 0 )
+    if( n < count && n >= 0 )
         return wxXmStringToString( strlist[n] );
     else
         return wxEmptyString;