Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected bugs with cursor in TextField #18371

Merged
merged 2 commits into from Oct 23, 2017
Merged

Corrected bugs with cursor in TextField #18371

merged 2 commits into from Oct 23, 2017

Conversation

1scaR1
Copy link
Contributor

@1scaR1 1scaR1 commented Oct 14, 2017

  1. Fixed bug in ccui TextFiled with cursor, when secure input enabled (if enable secure text entry and cursor, it will not be show)
  2. Fixed bug in TextFiledTTF with setting placeholder text when field is empty and keyboard attached(this leads to displaying placeholder text && incorrect cursor positioning), code example:
    auto input = cocos2d::ui::TextField::create();
    
    input->addEventListener([=](Ref* sender, Ref*, cocos2d::ui::TextField::EventType type) {
        if(type == cocos2d::ui::TextField::EventType::ATTACH_WITH_IME)
            input->setPlaceHolder("Some string");
    });

@minggo
Copy link
Contributor

minggo commented Oct 16, 2017

Fixed bug in ccui TextFiled with cursor, when secure input enabled (if enable secure text entry and cursor, it will not be show)

Could you please paste some codes to reproduce it?

@1scaR1
Copy link
Contributor Author

1scaR1 commented Oct 16, 2017

auto textField = cocos2d::ui::TextField::create("input password here","fonts/arial.ttf",30); //font from your cpp-test resources
textField->setPasswordEnabled(true);
textField->setCursorEnabled(true);
this->addChild(textField);

Enter some text in TextField, and cursor disappears.

@minggo
Copy link
Contributor

minggo commented Oct 17, 2017

I have verified issue 1, but i don't quite understand issue 2(Fixed bug in TextFiledTTF with setting placeholder text when field is empty and keyboard attached(this leads to displaying placeholder text && incorrect cursor positioning), code example:). Could you please describe it in more detail about what's the issue?

@1scaR1
Copy link
Contributor Author

1scaR1 commented Oct 17, 2017

I have the code like this:

auto input = cocos2d::ui::TextField::create("paceholder", "my_font_name", 20);
input-> setCursorEnabled(true);    
input->addEventListener([=](Ref* sender, Ref*, cocos2d::ui::TextField::EventType type) {
    if(type == cocos2d::ui::TextField::EventType::ATTACH_WITH_IME)
           input->setPlaceHolder("Some string");
});

State before pressing the text field(It's empty)
2017-10-17 9 39 24
And state after pressing the text field(Letter "o" also blinking, instead of cursor)
2017-10-17 9 39 35
I except that after pressing, text field must become empty(because of cursor)

@minggo minggo added this to the 3.17 milestone Oct 23, 2017
@minggo minggo merged commit 4726fa3 into cocos2d:v3 Oct 23, 2017
stevetranby added a commit to stevetranby/cocos2d-x that referenced this pull request Oct 24, 2017
* commit '76ba85adfbb1deedf52162386012afa961c9c016':
  Make cocos' Android.mk self containing (cocos2d#18392) (cocos2d#18393)
  [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#18397)
  Fix for Non-TTF Label Shadow, it makes it follow label opacity (cocos2d#18324)
  Remove autorelease mark from UIWebViewWrapper and manage memory manually (cocos2d#18391)
  Corrected bugs with cursor in TextField (cocos2d#18371)
  Fix Windows 10 compilation (cocos2d#18394)

# Conflicts:
#	cocos/base/ccConfig.h
@1scaR1 1scaR1 deleted the up_v3 branch November 2, 2017 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants