]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/controls/controls.cpp
constness for accessors of enum data
[wxWidgets.git] / samples / controls / controls.cpp
index 0d8ecf7f94c768d7c985ff773574e1c1f1312bc6..653a78f1b865b4eeb8a1a47f08edfa24a2a5f8d5 100644 (file)
@@ -553,8 +553,6 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
                             wxPoint(0, 250), wxSize(100, 50), wxTE_MULTILINE);
     m_text->SetBackgroundColour(wxT("wheat"));
 
-    if ( 0 )
-        wxLog::AddTraceMask(_T("focus"));
     m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text));
 
     m_notebook = new wxNotebook(this, ID_NOTEBOOK);
@@ -1081,15 +1079,19 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
             }
         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_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;
             }