void CProgressBarBasicTest::onClick(Ref* pSender) { CButton* pButton = (CButton*) pSender; if( pButton->getUserTag() == 1 ) { m_pProgressBar->setValue(m_pProgressBar->getValue() + 10); } else if( pButton->getUserTag() == 2 ) { m_pProgressBar->setValue(m_pProgressBar->getValue() - 5); } else if( pButton->getUserTag() == 3 ) { if( m_pProgressBar->getDirection() == eProgressBarDirectionLeftToRight ) { m_pProgressBar->setDirection(eProgressBarDirectionRightToLeft); } else { m_pProgressBar->setDirection(eProgressBarDirectionLeftToRight); } } else if( pButton->getUserTag() == 4 ) { m_pProgressBar->startProgress(100, 5.0f); } else if( pButton->getUserTag() == 5 ) { m_pProgressBar->stopProgress(); } }
void CExpandableListViewBasicTest::onClick(CCObject* pSender) { CButton* pButton = (CButton*) pSender; pListView->collapse(pButton->getUserTag()); pListView->reloadData(); }
void Bagui::event_btn_gv(Ref* pSender) { CButton *btn = (CButton*)pSender; int id = btn->getUserTag(); CCLOG("id = %d", id); }
void Recomebineui::event_btn_click(Ref* pSender) { CButton *btn = (CButton*)pSender; int id = btn->getUserTag(); CCLOG("id = %d", id); }
void ViewScene::buttonClick(CCObject* pSender){ CCLog("ViewScene::buttonClick"); CButton* pBtn = (CButton*)pSender; selectDeleteNote = pBtn->getUserTag(); //delete function CCSprite* backgroundImg = CCSprite::create("strangedesign/Dlg_background.png"); PopCancelLayer* dialog = PopCancelLayer::create("strangedesign/Dlg_background.png"); dialog->setContentSize(backgroundImg->getContentSize()); dialog->addButton("strangedesign/Dlg_delete_button.png","strangedesign/Dlg_delete_button_down.png","Y",0); dialog->setCallBackFunc(this,callfuncN_selector(ViewScene::dlgCallback)); CCDirector::sharedDirector()->getRunningScene()->addChild(dialog,10,1001); }
bool MainScene::buttonLongClick(CCObject* pSender, CCTouch* pTouch){ // long press enter edit UI CCSprite* backgroundIMG = CCSprite::create("strangedesign/Dlg_background.png"); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); PopCancelLayer* exitDialog = PopCancelLayer::create("strangedesign/Dlg_background.png"); CCSize originSize = CCSizeMake(winSize.width*0.75,winSize.height*0.5); exitDialog->setContentSize(backgroundIMG->getContentSize()); //exitDialog->setTitle("Setting",50); //exitDialog->setContentText("Setting Loose or tight!",60,100,150); exitDialog->setCallBackFunc(this,callfuncN_selector(MainScene::dlgCallBack)); exitDialog->addButton("strangedesign/Dlg_delete_button.png","strangedesign/Dlg_delete_button_down.png","Y",0); exitDialog->addButton("strangedesign/Dlg_edit_button.png","strangedesign/Dlg_edit_button_down.png","N",1); // exitDialog->addButton("strangedesign/Dlg_cancel_button.png","strangedesign/Dlg_cancel_button_down.png","N",2); CCDirector::sharedDirector()->getRunningScene()->addChild(exitDialog,100,TAG_SETTING_LAYER); CButton* pButton = (CButton*)pSender; int idx = pButton->getUserTag(); longClickSelectUnitID = unit_ids.at(idx); return true; }
void CTableViewBindingDataAndVertical::onClick(Ref* pSender) { CButton* pButton = (CButton*) pSender; pText->setString(m_vDatas[pButton->getUserTag()].c_str()); }
void CListViewOperateTest::onClick(Ref* pSender) { CButton* pButton = (CButton*) pSender; switch(pButton->getUserTag()) { case 1: { CLayout* pLayout = CLayout::create(); pLayout->setContentSize(Size(480, 30)); /* CColorView* pColor = CColorView::create(Color4B(128, 0, 0, 255)); pColor->setContentSize(Size(478, 28)); pColor->setPosition(Point(480/2, 30/2)); pLayout->addChild(pColor); */ CButton* pButton = CButton::createWith9Sprite(Size(150, 25), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(480 /2, 30 /2)); char str[64] = {0}; sprintf(str, "%d", last_add_idx); pButton->initText(str, "", 20); pLayout->addChild(pButton); last_add_idx++; m_pListView->insertNodeAtLast(pLayout); m_pListView->reloadData(); } break; case 2: { CLayout* pLayout = CLayout::create(); pLayout->setContentSize(Size(480, 30)); /* CColorView* pColor = CColorView::create(Color4B(0, 128, 0, 255)); pColor->setContentSize(Size(478, 28)); pColor->setPosition(Point(480/2, 30/2)); pLayout->addChild(pColor); */ CButton* pButton = CButton::createWith9Sprite(Size(150, 25), "sprite9_btn1.png", "sprite9_btn2.png"); pButton->setPosition(Vec2(480 /2, 30 /2)); char str[64] = {0}; sprintf(str, "%d", last_add_idx); pButton->initText(str, "", 20); pLayout->addChild(pButton); last_add_idx++; m_pListView->insertNodeAtFront(pLayout); m_pListView->reloadData(); } break; case 3: { m_pListView->removeLastNode(); m_pListView->reloadData(); } break; case 4: { m_pListView->removeFrontNode(); m_pListView->reloadData(); } break; default: break; } }
void MainScene::buttonClick(CCObject* pSender){ CButton* pButton = (CButton*)pSender; int idx = pButton->getUserTag(); string id = unit_ids.at(idx); // 将顺序数字转化成数据库中的id CCDirector::sharedDirector()->replaceScene(WallSingleScene::scene(id)); }