Forums » C++ Framework » How to limit input length of CCTextFieldTTF ? »
| kan don | How to limit input length of CCTextFieldTTF ? | ||
|---|---|---|---|
|
Added by kan don over 1 year ago
To limit max lengt of CCTexFieldTTF what should I do? UITextField it done by Implement the UITextFieldDelegate protocol I was try using CCTextFieldDelegate but still work strange when it's length over MAX_LENGTH. #define MAX_LENGTH = 5; class UITextFieldDelegate: public CCTextFieldDelegate { CC_UNUSED_PARAM(sender); Thank you. |
||
| 小 苏 | RE: How to limit input length of CCTextFieldTTF ? | ||
|
Added by 小 苏 over 1 year ago
I check it for "number input",i think it also can be check for input length. /** |
||
| kan don | RE: How to limit input length of CCTextFieldTTF ? | ||
|
Added by kan don over 1 year ago
It dosen't work completely. I was try using CCTextFieldDelegate but still work strange when it's length over 5. class UITextFieldDelegate: public CCTextFieldDelegate
{ |
||
| Jaeseong Heo | RE: How to limit input length of CCTextFieldTTF ? | ||
|
Added by Jaeseong Heo 5 months ago
Ok. I got it. 'Return' button on soft keyboard does not mean 'detachIME'. So I had to check '\n' character before check the length of sender->getString(). if(strcmp(text, "\n") == 0) { |
(1-3/3)