Class CCEditBox

#include <Geode/cocos/extensions/GUI/CCEditBox/CCEditBox.h>

\brief Class for edit box.

You can use this widget to gather small amounts of text from the user.

Examples0
Public static methods1
staticcocos2d::extension::CCEditBox*create(,,,)

create a edit box with size.

Return value
An autorelease pointer of CCEditBox, you don't need to release it only if you retain it again.
Public member functions35
boolinitWithSizeAndBackgroundSprite(,)

Init edit box with specified size. This method should be invoked right after constructor.

Parameters

size

The size of edit box.
voidsetDelegate()

Gets/Sets the delegate for edit box.

cocos2d::extension::CCEditBoxDelegate*getDelegate()
No description provided
voidregisterScriptEditBoxHandler(
inthandler
)

Registers a script function that will be called for EditBox events.

This handler will be removed automatically after onExit() called.

Parameters

handler

A number that indicates a lua function.
-- lua sample
local function editboxEventHandler(eventType)
    if eventType == "began" then
        -- triggered when an edit box gains focus after keyboard is shown
    elseif eventType == "ended" then
        -- triggered when an edit box loses focus after keyboard is hidden.
    elseif eventType == "changed" then
        -- triggered when the edit box text was changed.
    elseif eventType == "return" then
        -- triggered when the return button was pressed or the outside area of keyboard was touched.
    end
end

local editbox = CCEditBox:create(CCSize(...), CCScale9Sprite:create(...))
editbox = registerScriptEditBoxHandler(editboxEventHandler)
voidunregisterScriptEditBoxHandler()

Unregisters a script function that will be called for EditBox events.

intgetScriptEditBoxHandler()

get a script Handler

voidsetText()

Set the text entered in the edit box.

Parameters

pText

The given text.
charconst*getText()

Get the text entered in the edit box.

Return value
The text entered in the edit box.
voidsetFont(
charconst*pFontName
,
intfontSize
)

Set the font.

Parameters

pFontName

The font name.

fontSize

The font size.
voidsetFontName(
charconst*pFontName
)

Set the font name.

Parameters

pFontName

The font name.
voidsetFontSize(
intfontSize
)

Set the font size.

Parameters

fontSize

The font size.
voidsetFontColor()

Set the font color of the widget’s text.

voidsetPlaceholderFont(
charconst*pFontName
,
intfontSize
)

Set the placeholder’s font.

Parameters

pFontName

The font name.

fontSize

The font size.
voidsetPlaceholderFontName(
charconst*pFontName
)

Set the placeholder’s font name.

Parameters

pFontName

The font name.
voidsetPlaceholderFontSize(
intfontSize
)

Set the placeholder’s font size.

Parameters

fontSize

The font size.
voidsetPlaceholderFontColor()

Set the font color of the placeholder text when the edit box is empty. Not supported on IOS.

voidsetPlaceHolder()

Set a text in the edit box that acts as a placeholder when an edit box is empty.

Parameters

pText

The given text.
charconst*getPlaceHolder()

Get a text in the edit box that acts as a placeholder when an edit box is empty.

voidsetInputMode()

Set the input mode of the edit box.

Parameters

inputMode

One of the EditBoxInputMode constants.
voidsetMaxLength(
intmaxLength
)

Sets the maximum input length of the edit box. Setting this value enables multiline input mode by default. Available on Android, iOS and Windows Phone.

Parameters

maxLength

The maximum length.
intgetMaxLength()

Gets the maximum input length of the edit box.

Return value
Maximum input length.
voidsetInputFlag()

Set the input flags that are to be applied to the edit box.

Parameters

inputFlag

One of the EditBoxInputFlag constants.
voidsetReturnType()

Set the return type that are to be applied to the edit box.

Parameters

returnType

One of the CCKeyboardReturnType constants.
virtualvoidsetPosition()
No description provided
virtualvoidsetVisible(
boolvisible
)
No description provided
virtualvoidsetContentSize()
No description provided
virtualvoidsetAnchorPoint()
No description provided
virtualvoidvisit()
No description provided
virtualvoidonEnter()
No description provided
virtualvoidonExit()
No description provided
virtualvoidkeyboardWillShow()
No description provided
virtualvoidkeyboardDidShow()
No description provided
virtualvoidkeyboardWillHide()
No description provided
virtualvoidkeyboardDidHide()
No description provided
voidtouchDownAction(,)

callback funtions

Fields16
;
No description provided
;
No description provided
;
No description provided
;
No description provided
;
No description provided
gd::stringm_strText
;
No description provided
gd::stringm_strPlaceHolder
;
No description provided
gd::stringm_strFontName
;
No description provided
gd::stringm_strPlaceholderFontName
;
No description provided
intm_nFontSize
;
No description provided
intm_nPlaceholderFontSize
;
No description provided
;
No description provided
cocos2d::ccColor3Bm_colPlaceHolder
;
No description provided
intm_nMaxLength
;
No description provided
floatm_fAdjustHeight
;
No description provided
intm_nScriptEditBoxHandler
;
No description provided
Protected member functions0
Protected fields0
Derived classes0