EditBox and TextField strange behavior

EditBox and TextField strange behavior

I need to create simple sign in scene. At first i used EditBox. Everything good except password field. When I type characters are entered in the small size, but when I finish typing the size changes (look first video). This issue appears on Android and macOS but not on iOS.
Then i decided use TextField class. But i need align text to left. I set _passwordTextField->setTextHorizontalAlignment(TextHAlignment::LEFT);
but no effect (look second video).

cocos2d-x v3.17

Used system font “Helvetica” with size 32.

hi can you please help me with edit box in Cocos2dx, I have set placeholder , when i click on editbox , text jumps up in editbox and when i click out side of editbox it gets back down, so how can i stop that. thanks in advance

EditBox too complicated and i decide not use it. Better use TextField. I solve problem with text alignment, just need set label dimensions like that:
((Label*)textField->getVirtualRenderer())->setDimensions(textField->getContentSize().width, 0.0f);

thanks for helping me out :slight_smile: I have to try edit box, if i won’t found solution for it, I am definitely gonna use this one

@slackmoehrle @smitpatel88 hi… I am using it but now I am fetching another problem with it, if i am keep typing it automatically goes to another line and keep showing two line, how can i have only one line textfield, Hope you can help me out ? thanks in advance :slight_smile:

You can try fix vertical dimension as well. Also try setLineBreakWithoutSpace(). Or you can just set line limit on text field.
Also i found solution for EditBox. I just put my .ttf (or .otf) font to Resources/fonts/ folder, then add code line
editBox->setFont("fonts/OpenSans-Regular.ttf", 28);
Works on android and iOS, but when InputFlag::PASSWORD, EditBox still looks broken.