Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17080

Really struggling with win10 tablet mode and virtual keyboard - Help?

$
0
0

@katieJ wrote:

Hi,

Here is my scenario:

// Create a text field
auto playerNameTextField = cocos2d::TextFieldTTF::textFieldWithPlaceHolder("Click here to type", cocos2d::Size(400, 200), TextHAlignment::CENTER, "Arial", 42.0);
playerNameTextField->setPosition(inherited::getGridPosition(7, 6));
playerNameTextField->setTag(uiElements.playerNameTag);
playerNameTextField->setAnchorPoint(defaultAnchorPoint);
playerNameTextField->setDelegate(this);

Then later I do this:

auto modal = inherited::getModalBackground();
if (modal) {
	// Player Name
	cocos2d::TextFieldTTF* playerNameTextField = static_cast<cocos2d::TextFieldTTF*>(modal->getChildByTag(uiElements.playerNameTag));
	// Events		
	auto touchListener = EventListenerTouchOneByOne::create();
	touchListener->onTouchBegan = [](cocos2d::Touch* touch, cocos2d::Event * event) -> bool {
		try {
			// Show the on screen keyboard
			auto textField = dynamic_cast<cocos2d::TextFieldTTF*>(event->getCurrentTarget());
			textField->attachWithIME();
			return true;
		}
		catch (std::bad_cast & err) {
			return true;
		}
	};
	this->_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, playerNameTextField);
}

All the delegates are firing i.e. these:

bool PlayerNameModal::onTextFieldAttachWithIME(TextFieldTTF *sender) {
return TextFieldDelegate::onTextFieldAttachWithIME(sender);
}
bool PlayerNameModal::onTextFieldDetachWithIME(TextFieldTTF *sender) {
return TextFieldDelegate::onTextFieldDetachWithIME(sender);
}
bool PlayerNameModal::onTextFieldInsertText(TextFieldTTF *sender, const char *text, size_t nLen) {
return TextFieldDelegate::onTextFieldInsertText(sender, text, nLen);
}
bool PlayerNameModal::onTextFieldDeleteBackward(TextFieldTTF *sender, const char *delText, size_t nLen) {
return TextFieldDelegate::onTextFieldDeleteBackward(sender, delText, nLen);
}

The tablet is in tablet mode and it will not show the virtual keyboard despite the callback firing and issuing "textField->attachWithIME()" and all the delegates being fired.

It's possible to switch to non tablet mode, manually show the keyboard and then dismiss it but that will be really horrible for the user?

Has anyone found a solution to this, my guess is it's only a win10 issue?

Thanks,

Katie

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17080

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>