mirror of https://github.com/axmolengine/axmol.git
Misc. UIEditBoxImpl-winrt fixes (#16773)
* SENSITIVE doesn't imply password, fixes crash on static cast in * onTextChanged * Fix type fontName instead of pFontName * Set attributes that affect text content before setting initial text
This commit is contained in:
parent
7e14812240
commit
e20c1e0a9a
|
@ -87,10 +87,10 @@ namespace cocos2d {
|
||||||
passwordBox->Width = _size.Width;
|
passwordBox->Width = _size.Width;
|
||||||
passwordBox->Height = _size.Height;
|
passwordBox->Height = _size.Height;
|
||||||
passwordBox->Foreground = ref new Media::SolidColorBrush(_color);
|
passwordBox->Foreground = ref new Media::SolidColorBrush(_color);
|
||||||
passwordBox->Password = _initialText;
|
|
||||||
passwordBox->FontSize = _fontSize;
|
passwordBox->FontSize = _fontSize;
|
||||||
passwordBox->FontFamily = ref new Media::FontFamily(_fontFamily);
|
passwordBox->FontFamily = ref new Media::FontFamily(_fontFamily);
|
||||||
passwordBox->MaxLength = _maxLength;
|
passwordBox->MaxLength = _maxLength;
|
||||||
|
passwordBox->Password = _initialText;
|
||||||
_changeToken = passwordBox->PasswordChanged += ref new Windows::UI::Xaml::RoutedEventHandler(this, &cocos2d::ui::EditBoxWinRT::onPasswordChanged);
|
_changeToken = passwordBox->PasswordChanged += ref new Windows::UI::Xaml::RoutedEventHandler(this, &cocos2d::ui::EditBoxWinRT::onPasswordChanged);
|
||||||
return passwordBox;
|
return passwordBox;
|
||||||
}
|
}
|
||||||
|
@ -103,12 +103,12 @@ namespace cocos2d {
|
||||||
textBox->Width = _size.Width;
|
textBox->Width = _size.Width;
|
||||||
textBox->Height = _size.Height;
|
textBox->Height = _size.Height;
|
||||||
textBox->Foreground = ref new Media::SolidColorBrush(_color);
|
textBox->Foreground = ref new Media::SolidColorBrush(_color);
|
||||||
textBox->Text = _initialText;
|
|
||||||
textBox->FontSize = _fontSize;
|
textBox->FontSize = _fontSize;
|
||||||
textBox->FontFamily = ref new Media::FontFamily(_fontFamily);
|
textBox->FontFamily = ref new Media::FontFamily(_fontFamily);
|
||||||
textBox->MaxLength = _maxLength;
|
textBox->MaxLength = _maxLength;
|
||||||
textBox->AcceptsReturn = _multiline;
|
textBox->AcceptsReturn = _multiline;
|
||||||
textBox->TextWrapping = _multiline ? TextWrapping::Wrap : TextWrapping::NoWrap;
|
textBox->TextWrapping = _multiline ? TextWrapping::Wrap : TextWrapping::NoWrap;
|
||||||
|
textBox->Text = _initialText;
|
||||||
setInputScope(textBox);
|
setInputScope(textBox);
|
||||||
_changeToken = textBox->TextChanged += ref new Windows::UI::Xaml::Controls::TextChangedEventHandler(this, &cocos2d::ui::EditBoxWinRT::onTextChanged);
|
_changeToken = textBox->TextChanged += ref new Windows::UI::Xaml::Controls::TextChangedEventHandler(this, &cocos2d::ui::EditBoxWinRT::onTextChanged);
|
||||||
return textBox;
|
return textBox;
|
||||||
|
@ -253,7 +253,6 @@ namespace cocos2d {
|
||||||
_password = false;
|
_password = false;
|
||||||
switch ((EditBox::InputFlag)inputFlags) {
|
switch ((EditBox::InputFlag)inputFlags) {
|
||||||
case EditBox::InputFlag::PASSWORD:
|
case EditBox::InputFlag::PASSWORD:
|
||||||
case EditBox::InputFlag::SENSITIVE:
|
|
||||||
_password = true;
|
_password = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -369,10 +368,10 @@ namespace cocos2d {
|
||||||
_system_control->setFontSize(_fontSize * cocos2d::Director::getInstance()->getOpenGLView()->getScaleY() /** scale.y*/);
|
_system_control->setFontSize(_fontSize * cocos2d::Director::getInstance()->getOpenGLView()->getScaleY() /** scale.y*/);
|
||||||
|
|
||||||
// fontFamily
|
// fontFamily
|
||||||
auto font = cocos2d::FontFreeType::create(pFontName, fontSize /* TODO: Not sure if supposed to be scaled or unscaled */, cocos2d::GlyphCollection::DYNAMIC, nullptr);
|
auto font = cocos2d::FontFreeType::create(pFontName, fontSize, cocos2d::GlyphCollection::DYNAMIC, nullptr);
|
||||||
if (font != nullptr) {
|
if (font != nullptr) {
|
||||||
std::string fontName = "ms-appx:///Assets/Resources/" + std::string(pFontName) +'#' + font->getFontFamily();
|
std::string fontName = "ms-appx:///Assets/Resources/" + std::string(pFontName) +'#' + font->getFontFamily();
|
||||||
_system_control->setFontFamily(PlatformStringFromString(pFontName));
|
_system_control->setFontFamily(PlatformStringFromString(fontName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,4 +458,4 @@ namespace cocos2d {
|
||||||
|
|
||||||
} // namespace cocos2d
|
} // namespace cocos2d
|
||||||
|
|
||||||
#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||||
|
|
Loading…
Reference in New Issue