void CHandBookPanel::onSwitchBtn( CCObject *pSender, bool bChecked ) { CRadioButton* pBtn = (CRadioButton*)pSender; int iSelectIndex = pBtn->getTag(); if (bChecked) { PlayEffectSound(SFX_Button); selectTabPanel((HandBookTabType)iSelectIndex); } }
BOOL LLTabContainer::selectTabByName(const std::string& name) { LLPanel* panel = getPanelByName(name); if (!panel) { llwarns << "LLTabContainer::selectTabByName(" << name << ") failed" << llendl; return FALSE; } BOOL result = selectTabPanel(panel); return result; }
void CHandBookPanel::onEnter() { BaseLayer::onEnter(); //选项卡 CRadioBtnGroup *radioGroup = (CRadioBtnGroup *)m_ui->findWidgetById("radio"); for (unsigned int i=0; i<HandBookTabMax; i++) { CRadioButton *radioBtn= (CRadioButton*)(radioGroup->getChildByTag(i)); radioBtn->setOnCheckListener(this,ccw_check_selector(CHandBookPanel::onSwitchBtn)); } //退出 CButton* pClose = CButton::create("common/back.png", "common/back.png"); pClose->getSelectedImage()->setScale(1.1f); pClose->setPosition(VLEFT+50, VTOP-50); pClose->setOnClickListener(this,ccw_click_selector(CHandBookPanel::onClose)); this->addChild(pClose, 999); //默认选择一个 selectTabPanel(HandBookTabHero); }