CCEditBox - Can't Get Any Input (iOS)

CCEditBox - Can't Get Any Input (iOS)
0.0 0


I am trying to implement text input in our cocos2d-x 2.2.1 game. I have created a CCEditBox but can’t get it to take any input, and can’t get any of its delegate methods to fire. The edit box comes up looking just like text and acting like a button, but the background is not visible, and I can’t get it to take any input.

I have compared my code to the test project and can’t really see anything that I am missing.

A few other random notes:

void CCControlButton::ccTouchEnded fires sendActionsForControlEvents

The CCEditBoxImplIOS does get created and the delegate seems to be properly set.

I did notice that in CCEditBoxImplIOS::adjustTextFieldPosition() the position was being set to -20,100 no matter where I placed the CCEditBox, but I am guessing that it’s intentional?

I stepped into sendActionsForControlEvents but found that invocationList was empty and that getHandleOfControlEvent was returning -1, if that helps.

	class CCEditBoxAdaptor : public CCControlButtonAdaptor, public cocos2d::extension::CCEditBoxDelegate
		FLUX_TYPEDEF(CCEditBoxAdaptor, CCControlButtonAdaptor)
		CCEditBoxAdaptor() {LOGCTOR}
		virtual ~CCEditBoxAdaptor() {LOGDTOR}
		virtual void Init(lua_State* L, FluxGraph* nodeTree);
		virtual void editBoxEditingDidBegin(cocos2d::extension::CCEditBox* editBox);
		virtual void editBoxEditingDidEnd(cocos2d::extension::CCEditBox* editBox);
		virtual void editBoxTextChanged(cocos2d::extension::CCEditBox* editBox, const std::string& text);
		virtual void editBoxReturn(cocos2d::extension::CCEditBox* editBox);
		AutoRetainCount<FluxLuaObject> mDidBeginEditingFunction;
		AutoRetainCount<FluxLuaObject> mDidEndEditingFunction;
		AutoRetainCount<FluxLuaObject> mTextChangedFunction;
		AutoRetainCount<FluxLuaObject> mReturnFunction;

 void CCEditBoxAdaptor::Init(lua_State* L, FluxGraph* nodeTree)
	CCScale9Sprite* sprite = CCScale9Sprite::create("backgrounds/bg9.png");
	CCEditBox* editBox = CCEditBox::create(CCSize(40,200), sprite);
	mNode = editBox;
	editBox->setFont(fontName.c_str(), fontSize);

void CCEditBoxAdaptor::editBoxEditingDidBegin(cocos2d::extension::CCEditBox* editBox)

void CCEditBoxAdaptor::editBoxEditingDidEnd(cocos2d::extension::CCEditBox* editBox)

void CCEditBoxAdaptor::editBoxTextChanged(cocos2d::extension::CCEditBox* editBox, const std::string& text)

void CCEditBoxAdaptor::editBoxReturn(cocos2d::extension::CCEditBox* editBox)


Never mind, just a silly bug. Thanks all.