Class ccui.TextField
- Defined in: UITextField.js
- Extends ccui.Widget
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Class Detail
ccui.TextField()
Field Detail
<static> <constant>
ccui.TextField.EVENT_ATTACH_WITH_IME
The attach with IME event flag of ccui.TextField
<static> <constant>
ccui.TextField.EVENT_DELETE_BACKWARD
The delete backward event flag of ccui.TextField
<static> <constant>
ccui.TextField.EVENT_DETACH_WITH_IME
The detach with IME event flag of ccui.TextField
<static> <constant>
ccui.TextField.EVENT_INSERT_TEXT
The insert text event flag of ccui.TextField
{String}
font
- The text field font with a style string: e.g. "18px Verdana"
{String}
fontName
- The text field font name
{Number}
fontSize
- The text field font size
{Number}
maxLength
- The max length of the text field
{Boolean}
maxLengthEnabled
- Indicate whether max length limit is enabled
{Boolean}
passwordEnabled
- Indicate whether the text field is for entering password
{String}
placeHolder
- The place holder of the text field
<static> <constant>
ccui.TextField.RENDERER_ZORDER
The zOrder value of ccui.TextField's renderer.
{String}
string
- The content string of the label
Method Detail
-
addEventListener(target, selector)Adds event listener callback.
- Parameters:
- {Object} target Optional
- {Function} selector
-
addEventListenerTextField(target, selector)Adds event listener to cuci.TextField.
- Parameters:
- {Object} target Optional
- {Function} selector
- Deprecated:
- since v3.0, please use addEventListener instead.
-
{Boolean} attachWithIME()Open keyboard and receive input text.
- Returns:
- {Boolean}
-
Creates a ccui.TextField.
- Parameters:
- {String} placeholder
- {String} fontName
- {Number} fontSize
- Deprecated:
- since v3.0, please use new ccui.TextField() instead.
- Returns:
- {ccui.TextField}
-
ctor(placeholder, fontName, fontSize)allocates and initializes a UITextField. Constructor of ccui.TextField. override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
// example var uiTextField = new ccui.TextField();
- Parameters:
- {string} placeholder
- {string} fontName
- {Number} fontSize
-
didNotSelectSelf()detach with IME
-
{Boolean} getAttachWithIME()Returns whether attach with IME.
- Returns:
- {Boolean}
-
{Boolean} getDeleteBackward()Returns the delete backward of ccui.TextField.
- Returns:
- {Boolean}
-
{string} getDescription()Returns the "class name" of ccui.TextField.
- Returns:
- {string}
-
{Boolean} getDetachWithIME()Returns whether detach with IME.
- Returns:
- {Boolean}
-
{String} getFontName()Returns font name of ccui.TextField.
- Returns:
- {String} font name
-
{Number} getFontSize()Gets font size of ccui.TextField.
- Returns:
- {Number} size
-
{String} getInsertText()Returns insertText string of ccui.TextField.
- Returns:
- {String}
-
{number} getMaxLength()Returns the max length of ccui.TextField.
- Returns:
- {number} length
-
{String} getPasswordStyleText()Returns the password style character.
- Returns:
- {String}
-
{String} getPlaceHolder()Returns the placeholder string.
- Returns:
- {String}
-
{cc.Color} getPlaceHolderColor()Returns the color of ccui.TextField's place holder.
- Returns:
- {cc.Color}
-
{String} getString()Returns string value of ccui.TextField.
- Returns:
- {String}
-
{Number} getStringLength()Returns the length of ccui.TextField.
- Returns:
- {Number}
-
{String} getStringValue()Returns textField string value
- Deprecated:
- since v3.0, please use getString instead.
- Returns:
- {String}
-
{cc.Size} getTouchSize()Returns touch size of ccui.TextField.
- Returns:
- {cc.Size}
-
{cc.Node} getVirtualRenderer()Returns the renderer of ccui.TextField.
- Returns:
- {cc.Node}
-
{cc.Size} getVirtualRendererSize()Returns the ccui.TextField's content size.
- Returns:
- {cc.Size}
-
{boolean} hitTest(pt)Checks a point if is in ccui.TextField's space
- Parameters:
- {cc.Point} pt
- Returns:
- {boolean}
-
{boolean} init()Initializes a ccui.TextField. Please do not call this function by yourself, you should pass the parameters to constructor to initialize it.
- Returns:
- {boolean}
-
{Boolean} isMaxLengthEnabled()Returns Whether to open string length limit.
- Returns:
- {Boolean}
-
{Boolean} isPasswordEnabled()Returns whether to open setting string as password character.
- Returns:
- {Boolean}
-
onEnter()Calls parent class' onEnter and schedules update function.
-
onTouchBegan(touchPoint, unusedEvent)The touch began event callback handler.
- Parameters:
- {cc.Point} touchPoint
- unusedEvent
-
setAttachWithIME(attach)Sets attach with IME.
- Parameters:
- {Boolean} attach
-
setDeleteBackward(deleteBackward)Sets the delete backward of ccui.TextField.
- Parameters:
- {Boolean} deleteBackward
-
setDetachWithIME(detach)Sets detach with IME.
- Parameters:
- {Boolean} detach
-
setFontName(name)Sets font name for ccui.TextField
- Parameters:
- {String} name
-
setFontSize(size)Sets font size for ccui.TextField.
- Parameters:
- {Number} size
-
setInsertText(insertText)Sets insertText string to ccui.TextField.
- Parameters:
- {String} insertText
-
setMaxLength(length)Sets the max length of ccui.TextField. Only when you turn on the string length limit, it is valid.
- Parameters:
- {number} length
-
setMaxLengthEnabled(enable)Sets Whether to open string length limit for ccui.TextField.
- Parameters:
- {Boolean} enable
-
setPasswordEnabled(enable)Sets whether to open setting string as password character.
- Parameters:
- {Boolean} enable
-
setPasswordStyleText(styleText)Sets the password style character, Only when you turn on setting string as password character, it is valid.
- Parameters:
- styleText
-
setPlaceHolder(value)Sets the placeholder string.
display this string if string equal "".- Parameters:
- {String} value
-
setPlaceHolderColor(color)Sets the place holder color to ccui.TextField.
- Parameters:
- color
-
setString(text)Changes the string value of textField.
- Parameters:
- {String} text
-
setText(text)Changes the string value of textField.
- Parameters:
- {String} text
- Deprecated:
- since v3.0, please use setString instead.
-
setTextAreaSize(size)Sets the text area size to ccui.TextField.
- Parameters:
- {cc.Size} size
-
setTextColor(textColor)Sets the text color to ccui.TextField
- Parameters:
- textColor
-
setTextHorizontalAlignment(alignment)Sets the text horizontal alignment of ccui.TextField.
- Parameters:
- alignment
-
setTextVerticalAlignment(alignment)Sets the text vertical alignment of ccui.TextField.
- Parameters:
- alignment
-
setTouchAreaEnabled(enable)Sets whether use touch area.
- Parameters:
- enable
-
setTouchSize(size)Sets touch size of ccui.TextField.
- Parameters:
- {cc.Size} size