Class cc.TextFieldTTF
- Defined in: CCTextFieldTTF.js
- Extends cc.LabelTTF
Constructor Attributes | Constructor Name and Description |
---|---|
A simple text input field with TTF font.
|
Method Summary
Class Detail
cc.TextFieldTTF()
A simple text input field with TTF font.
Method Detail
-
{Boolean} attachWithIME()Open keyboard and receive input text.
- Returns:
- {Boolean}
-
{Boolean} canAttachWithIME()
- Returns:
- {Boolean}
-
{Boolean} canDetachWithIME()
- Returns:
- {Boolean}
-
<static> {cc.TextFieldTTF|Null} cc.TextFieldTTF.create(placeholder, dimensions, alignment, fontName, fontSize)creates a cc.TextFieldTTF from a fontName, alignment, dimension and font size
//example // When five parameters var textField = cc.TextFieldTTF.create("
", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32); // When three parameters var textField = cc.TextFieldTTF.create(" ", "Arial", 32); - Parameters:
- {String} placeholder
- {cc.Size} dimensions
- {Number} alignment
- {String} fontName
- {Number} fontSize
- Returns:
- {cc.TextFieldTTF|Null}
-
ctor()Constructor
-
deleteBackward()Delete backward
-
{Boolean} detachWithIME()End text input and close keyboard.
- Returns:
- {Boolean}
-
didAttachWithIME()When the delegate detach with IME, this method call by CCIMEDispatcher.
-
didDetachWithIME()When the delegate detach with IME, this method call by CCIMEDispatcher.
-
draw(ctx)
- Parameters:
- {CanvasContext} ctx
-
{Number} getCharCount()
- Returns:
- {Number}
-
{cc.Color3B} getColorSpaceHolder()
- Returns:
- {cc.Color3B}
-
{String} getContentText()
- Returns:
- {String}
-
{cc.Node} getDelegate()
- Returns:
- {cc.Node}
-
{String} getPlaceHolder()
- Returns:
- {String}
-
{String} getString()
- Returns:
- {String}
-
{Boolean} initWithPlaceHolder(placeholder, dimensions, alignment, fontName, fontSize)Initializes the cc.TextFieldTTF with a font name, alignment, dimension and font size
//example var textField = new cc.TextFieldTTF(); // When five parameters textField.initWithPlaceHolder("
", cc.size(100,50), cc.TEXT_ALIGNMENT_LEFT,"Arial", 32); // When three parameters textField.initWithPlaceHolder(" ", "Arial", 32); - Parameters:
- {String} placeholder
- {cc.Size} dimensions
- {Number} alignment
- {String} fontName
- {Number} fontSize
- Returns:
- {Boolean}
-
insertText(text, len)
- Parameters:
- {String} text
- {Number} len
-
removeDelegate()Remove delegate
-
setColorSpaceHolder(value)
- Parameters:
- {cc.Color3B} value
-
setDelegate(value)
- Parameters:
- {cc.Node} value
-
setPlaceHolder(text)
- Parameters:
- {String} text
-
setString(text)Input text property
- Parameters:
- {String} text