Found Solution to EditBox! [SOLVED]

EditBox is quite good, considering it has to run on multiple platforms. However, lots of folks have commented how it just doesn’t behave correctly on Windows and Mac (it shifts the existing text when you click in the box).

Well, I found the solution, and wanted to share it! This makes EditBox truly cross-platform.

Simply modify the editBoxEditingDidBegin method as follows:

void MyClass::editBoxEditingDidBegin(cocos2d::ui::EditBox *editBox)
{
  string str = editBox->getText();
  editBox->setText("");
  editBox->setText(str.c_str());
}
1 Like