@pabitrapadhy wrote:
Hello Developers,
Is there any way to make
EditBox
accept alphabets only ?
This is my code -this->_editBox = ui::EditBox::create(Size(230, 93), "PMHomeScene/profile_bar.png"); this->_editBox->setFontName("fonts/Marker Felt.ttf"); this->_editBox->setInputMode(EditBox::InputMode::SINGLE_LINE); this->_editBox->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height*0.6)); this->_editBox->setFontColor(Color3B::BLACK); this->_editBox->setText(playerName.c_str()); this->_editBox->setPlaceholderFontColor(Color3B::BLACK); this->_editBox->setMaxLength(7); this->_editBox->setScale(0.0f); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) this->_editBox->setReturnType(ui::EditBox::KeyboardReturnType::DONE); #else this->_editBox->setReturnType(ui::EditBox::KeyboardReturnType::SEND); #endif this->_editBox->setDelegate(this); this->_editBox->touchDownAction(this->_editBox, Widget::TouchEventType::ENDED); this->_popUpBox->addChild(this->_editBox);
Please guide me to achieve Alphabets only in
EditBox
.
This becomes essential when we useEditBox
to input player names.
Thank You. Image may be NSFW.
Clik here to view.
Posts: 1
Participants: 1