]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
Added wxString to NSString conversion functions
[wxWidgets.git] / samples / controls / controls.cpp
index 1fd8a2a5047b3567cacabf3b8eafc067a12e0980..f06c9955bf5acbb0eae04072dd1ee3ea78c53682 100644 (file)
@@ -812,7 +812,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
 
     (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20));
 
 
     (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20));
 
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || defined(__WXMOTIF__)
     // test for masked bitmap display
     bitmap = wxBitmap(_T("test2.bmp"), wxBITMAP_TYPE_BMP);
     if (bitmap.Ok())
     // test for masked bitmap display
     bitmap = wxBitmap(_T("test2.bmp"), wxBITMAP_TYPE_BMP);
     if (bitmap.Ok())
@@ -1081,15 +1081,19 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
             }
         case ID_LISTBOX_SEL_NUM:
             {
             }
         case ID_LISTBOX_SEL_NUM:
             {
-                m_listbox->SetSelection( 2 );
-                m_listboxSorted->SetSelection( 2 );
+                if (m_listbox->GetCount() > 2)
+                    m_listbox->SetSelection( 2 );
+                if (m_listboxSorted->GetCount() > 2)
+                    m_listboxSorted->SetSelection( 2 );
                 m_lbSelectThis->WarpPointer( 40, 14 );
                 break;
             }
         case ID_LISTBOX_SEL_STR:
             {
                 m_lbSelectThis->WarpPointer( 40, 14 );
                 break;
             }
         case ID_LISTBOX_SEL_STR:
             {
-                m_listbox->SetStringSelection( _T("This") );
-                m_listboxSorted->SetStringSelection( _T("This") );
+                if (m_listbox->FindString(_T("This")) > -1)
+                    m_listbox->SetStringSelection( _T("This") );
+                if (m_listboxSorted->FindString(_T("This")) > -1)
+                    m_listboxSorted->SetStringSelection( _T("This") );
                 m_lbSelectNum->WarpPointer( 40, 14 );
                 break;
             }
                 m_lbSelectNum->WarpPointer( 40, 14 );
                 break;
             }