X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07157c53d001f596d48d7e2281af7f4d013b0d72..62958ed73fa9568fc65923e73e4d8a9c9713c448:/samples/controls/controls.cpp diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index dd42a80064..f06c9955bf 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -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)); -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXMOTIF__) // 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: { - 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; } @@ -1690,7 +1694,7 @@ void MyComboBox::OnChar(wxKeyEvent& event) { wxLogMessage(_T("MyComboBox::OnChar")); - if ( event.KeyCode() == 'w' ) + if ( event.GetKeyCode() == 'w' ) wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); else event.Skip(); @@ -1700,7 +1704,7 @@ void MyComboBox::OnKeyDown(wxKeyEvent& event) { wxLogMessage(_T("MyComboBox::OnKeyDown")); - if ( event.KeyCode() == 'w' ) + if ( event.GetKeyCode() == 'w' ) wxLogMessage(_T("MyComboBox: 'w' will be ignored.")); else event.Skip();