auto editBoxSize = Size(visibleSize.width - 600, visibleSize.height * 0.1); std::string pNormalSprite = "green_edit.png"; _editName = ui::EditBox::create(editBoxSize + Size(0, 40), ui::Scale9Sprite::create(pNormalSprite)); _editName->setPosition(Vec2(visibleSize.width / 2 - 50, visibleSize.height * 3 / 4)); _editName->setFontColor(Color3B::RED); _editName->setPlaceHolder("Name:"); _editName->setPlaceholderFontColor(Color3B::WHITE); _editName->setFontSize(editBoxSize.height / 2); _editName->setText(" "); //_editName->setDelegate(this); _editName->setReturnType(ui::EditBox::KeyboardReturnType::DONE); addChild(_editName); Button* button = Button::create("start_game.png", "start_game_select.png"); auto buttonSize = button->getContentSize(); //button->setTitleText("Single Line"); button->setPosition(Point(780, 380)); button->addClickEventListener([=](Ref* ref){ _editName->setInputMode(ui::EditBox::InputMode::SINGLE_LINE); pText = _editName->getText(); log(pText," "); }); addChild(button);
在vs中效果图表示可以传递:
但是在eclipse中:怎么也接收不了 !
最初的假想:
1、参数格式不对--------已验证不是
2、在同一button下接收导致数据阻断-------已验证不是
3、get text代码接收不了-------未验证,(因为无法输出)