void ButtonTest::buttonCallback(CAControl* btn,CCPoint point) { CAButton* button = (CAButton*)btn; char text[50] = ""; switch (button->getTag()) { case 0: sprintf(text,"The first button.Touch point(%.02f,%.02f)",point.x,point.y); descTest->setText(text); break; case 1: sprintf(text, "The second button.Touch point(%.02f,%.02f)", point.x, point.y); descTest->setText(text); break; case 2: sprintf(text, "The third button.Touch point(%.02f,%.02f)", point.x, point.y); descTest->setText(text); break; default: break; } }
void ButtonTest::buttonCallback(CAControl* btn,CCPoint point) { point = btn->convertToWorldSpace(point); CAButton* button = (CAButton*)btn; char text[50] = ""; sprintf(text, "Button %d--Touch point(x: %.0f, y: %.0f)", button->getTag()+1,point.x, point.y); descTest->setText(text); }
void registerViewController::changeButtonView(CAControl*control, CCPoint){ CAView* _view2 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1.png")); CAView* _view3 = CAScale9ImageView::createWithImage(CAImage::create("image/bg1R.png")); CAButton* btn = dynamic_cast<CAButton*>(control); if (btn->getTag() ==99) { btn->setBackGroundViewForState(CAControlStateAll, _view2); // authCodeButton->setBackGroundViewForState(CAControlStateDisabled, CAView::createWithColor(CAColor_gray)); btn->setTag(100); } else if (btn->getTag() == 100) { btn->setBackGroundViewForState(CAControlStateAll, _view3); // authCodeButton->setBackGroundViewForState(CAControlStateNormal, CAView::createWithColor(CAColor_blue)); btn->setTag(99); } }
void FourthViewController::buttonCallback(CrossApp::CAControl *btn, CrossApp::CCPoint point) { point = btn->convertToWorldSpace(point); CAButton* button = (CAButton*)btn; if (button->getTag() == 1) { --action_index; action_index = MAX(action_index, 0); } else { ++action_index; action_index = MIN(action_index, 9); } defaultBtnL->setVisible(action_index > 0); defaultBtnR->setVisible(action_index < 9); if (action_index < 6) { char str[32]; sprintf(str, "play animation %d", action_index+1); defaultLable->setText(str); } else if (action_index < 9) { char str[32]; sprintf(str, "play animation %d", action_index+1 - 6); defaultLable->setText(str); } else { defaultLable->setText("play animation delay"); } flag = true; this->refreshView(false); }