void RadioBoxTestCase::Selection() { //Until other item containers the first item is selected by default CPPUNIT_ASSERT_EQUAL(0, m_radio->GetSelection()); CPPUNIT_ASSERT_EQUAL("item 0", m_radio->GetStringSelection()); m_radio->SetSelection(1); CPPUNIT_ASSERT_EQUAL(1, m_radio->GetSelection()); CPPUNIT_ASSERT_EQUAL("item 1", m_radio->GetStringSelection()); m_radio->SetStringSelection("item 2"); CPPUNIT_ASSERT_EQUAL(2, m_radio->GetSelection()); CPPUNIT_ASSERT_EQUAL("item 2", m_radio->GetStringSelection()); }
void MyFrame::OnVisibilityChange(wxCommandEvent& WXUNUSED(event)) { if ( m_visibilityRadioBox->GetSelection() == 0 ) MSWGetTaskBarButton()->Show(); else MSWGetTaskBarButton()->Hide(); }
/***** Make sure the user entry is a valid index for the selected type of part *****/ bool tmwxSelectPartByIndexDialog::Validate() { size_t maxIndex; wxString partTypeStr; mPartType = mRadioBox->GetSelection(); switch(mPartType) { case 0: partTypeStr = wxT("node"); maxIndex = mDoc->mTree->GetNodes().size(); break; case 1: partTypeStr = wxT("edge"); maxIndex = mDoc->mTree->GetEdges().size(); break; case 2: partTypeStr = wxT("path"); maxIndex = mDoc->mTree->GetPaths().size(); break; case 3: partTypeStr = wxT("poly"); maxIndex = mDoc->mTree->GetPolys().size(); break; case 4: partTypeStr = wxT("vertex"); maxIndex = mDoc->mTree->GetVertices().size(); break; case 5: partTypeStr = wxT("crease"); maxIndex = mDoc->mTree->GetCreases().size(); break; case 6: partTypeStr = wxT("facet"); maxIndex = mDoc->mTree->GetFacets().size(); break; default: maxIndex = 0; TMFAIL("unknown case"); } if (maxIndex == 0) { tmwxAlertError(wxString::Format( wxT("You can't select %s %s by index because there aren't any."), mPartType != 1 ? wxT("a") : wxT("an"), partTypeStr.c_str())); return false; } size_t index; if (!mTextCtrl->ValidateSizeT(wxString::Format(wxT("%s index"), partTypeStr.c_str()), 1, maxIndex, index, wxString::Format(wxT("%s %s index must be between 1 and %d."), mPartType != 1 ? wxT("A") : wxT("An"), partTypeStr.c_str(), int(maxIndex)))) return false; mPartOffset = index - 1; return true; }