Keyboard input not working

Hi,

I have a bug where keyboard input does not work on a few Android devices. The text input seems to either be wrong, not work at all or only work with a few characters.

Some players have been able to fix the issue by changing the keyboard layout to QWERTY and disabling auto-spelling, but this only works for some.

On iOS and most Android devices the keyboard input works perfectly, and I have not been able to reproduce the problem on my Galaxy S3 or Galaxy Tab 10.1.

I am using CCTextFieldTTF and this is my code for when a character is entered:

bool CCTextInputNode::onTextFieldInsertText(CCTextFieldTTF * pSender, const char * text, int nLen)
{
    // if insert enter, treat as default to detach with ime
    if ('\n' == *text)
    {
        return false;
    }

    std::string allowed = allowedChars_;

    std::string::size_type find = allowed.find(text);
    if (find == std::string::npos) return true;

    // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore.
    if (pSender->getCharCount() >= charLimit_ && charLimit_ > 0) return true;

    return false;
}

allowedChars_ is an std::string which contains all valid characters, such as " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".

Does anyone have an idea on what the problem could be or how to fix it? Appreciate the help :slight_smile:

1 Like

Anyone? Even a suggestion on where to look would help a lot :confused:

1 Like