Open
Description
Currently the prompt used by the CCIMEDispatcher is fixed as:
"please enter your word:"
It would be better if this could be set from the outside as it does with the current input string value. My suggestion would be to change the _focusDomInput method to the following (which allows the delegate to suggest the string:
_focusDomInput:function (delegate) {
if(cc.Browser.isMobile){
this.impl._delegateWithIme = delegate;
delegate.didAttachWithIME();
//prompt
this._currentInputString = delegate.getString ? delegate.getString() : "";
var promptString = delegate.getPrompt ? delegate.getPrompt() : "please enter your word:";
var userInput = prompt(promptString, this._currentInputString);
if(userInput != null)
this._processDomInputString(userInput);
this.dispatchInsertText("\n", 1);
}else{
this.impl._delegateWithIme = delegate;
this._currentInputString = delegate.getString ? delegate.getString() : "";
delegate.didAttachWithIME();
this._domInputControl.focus();
this._domInputControl.value = this._currentInputString;
this._domInputControlTranslate();
}
},
Then as a default the delegate in the textfield can provide a prompt (and can return the placeholder text). I do not know if this is considered a strong interface that needs to stay compatible with cocos2d-x though. The method added to the textfield would be.
getPrompt:function () {
return this._placeHolder;
},
Metadata
Metadata
Assignees
Labels
No labels