Cocos2d-x CCTextFieldTTF portrait mode bug?

Cocos2d-x CCTextFieldTTF portrait mode bug?
0.0 0


Video link address.

When entering a Korean language presents a problem.
Yeah, when it in portrait mode.
How do I fix this problem?
Galaxy S is a video of the device.
Feel the same way as other devices (Nexus S, Galaxy S2, Nexus one …)

The version is cocos2d-1.0.1-x-0.10.0

Examples of issues > ’가’input> ’기’display // ’다’input > ’ㄷ’display // ’대한민국’input> ’ㄷ하ㅁㄱ’display


I have viewed the video, but I don’t know what’s the problem.


Type the word will differ.
input ‘ga’~~> display ‘gi’
input ‘da’ -> display ‘di’
‘ga’ and ‘gi’ is an entirely different character.


I think it is language dependent.
Does it happen if the language is English?


English is not an issue. English is good.


If you type in English is not the problem. However, Hangul (Korean) have a problem.

If you are like a combination of inputs to other countries, I do not see how the
Currently Hangul (Korean) input is like the combination.
‘han’ when you enter the ‘ha’ is displayed.
In the case of English ‘A’ is a single letter. Hangul (Korean), the ‘h’ Hangul characters can not be alone.

For now, these issues include the end CCTextFieldTTF Hangul (Korean) can not be used by typing:

I guess, too. Each time you press the keypad, once recognized as one character that I think it’s cause.
Hangul (Korean), Hangul characters by pressing two or more are made.

If you can not solve this problem Hangul (Korean), it is impossible to use the input received.
Must be resolved.
JNI connection with any part of the map I want to hear a hint. In order to solve our own.

Our team should solve this problem quickly.
Come on, say thank you very much for that answer.


Sorry, we know nothing about Hangul (Korean).
So we don’t know how to resolve it.

If your team resolve it, could you please share it?


Yes, sir.
How to solve this problem be solved if we will share.


projectfolder->libs->cocos2dx->text_input_node-> CCIMEDispatcher.cpp

void CCIMEDispatcher::dispatchInsertText(const char * pText, int nLen)
//        CC_BREAK_IF(! m_pImpl || ! pText || nLen <= 0);
        CC_BREAK_IF(! m_pImpl || ! pText);

        // there is no delegate attach with ime
        CC_BREAK_IF(! m_pImpl->m_DelegateWithIme);

        m_pImpl->m_DelegateWithIme->insertText(pText, nLen);
    } while (0);


void CCTextFieldTTF::insertText(const char * text, int len)
    std::string sInsert(text, len);

    // insert \n means input end
    int nPos = sInsert.find('\n');
    if ((int)sInsert.npos != nPos)
        len = nPos;
    if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, sInsert.c_str(), len))
        // delegate doesn't want insert text

    m_nCharCount += _calcCharCount(sInsert.c_str());
    std::string sText(*m_pInputText);
    if (len > 0)
        if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, sInsert.c_str(), len))
            // delegate doesn't want insert text

        m_nCharCount += _calcCharCount(sInsert.c_str());
        std::string sText(*m_pInputText);

    if ((int)sInsert.npos == nPos) {

    // '\n' has inserted,  let delegate process first
    if (m_pDelegate && m_pDelegate->onTextFieldInsertText(this, "\n", 1))

    // if delegate hasn't process, detach with ime as default

android project->> afterTextChanged method

    public void afterTextChanged(Editable s) {
        if (isFullScreenEdit()) {

        LogD("afterTextChanged: " + s);
//      int nModified = s.length() - mText.length();
//      if (nModified > 0) {
//          final String insertText = s.subSequence(mText.length(), s.length()).toString();
//          mMainView.insertText(insertText);
//          LogD("insertText(" + insertText + ")");
//      }
//      else {
//          for (; nModified < 0; ++nModified) {
//              mMainView.deleteBackward();
//              LogD("deleteBackward");
//          }
//      }
//      mMainView.insertText(mText);
        mText = s.toString();






Eun-hyung Choi // Thanks for your solution.


good thank you!