Class TextInput

#include <Geode/ui/TextInput.hpp>
classTextInput:publiccocos2d::CCNode,publicTextInputDelegate{ ... }

A single-line text input node

Examples0
Public static methods1
staticgeode::TextInput*create(
floatwidth
,,)

Create a single-line text input with a background. Can either be used in delegate or callback mode; with callback mode, you don’t need to deal with adding TextInputDelegate to your class’ base list, you just install a callback function directly to the input itself

Parameters

width

The width of the input

placeholder

Placeholder text for the input

font

The font to use
Public member functions18
voidsetPlaceholder()

Set the placeholder label for this input

voidsetLabel()

Set a label on this input that shows up on the top. Set an empty string to remove the label

voidsetFilter(
std::stringconst&allowedChars
)

Set the filter (allowed characters) for this input

Parameters

allowedChars

String of allowed characters; each character in the string represents one allowed character
voidsetCommonFilter()

Set a commonly used filter (number, text, etc.)

voidsetMaxCharCount(
_::size_tlength
)

Set the maximum amount of characters for this input. Use 0 for infinite length

voidsetPasswordMode(
boolenable
)

Enable/disable password mode (all input characters are rendered as dots rather than the actual characters)

voidsetWidth(
floatwidth
)

Set the width of the label. This does not set the maximum character count; use setMaxCharCount for that

voidsetDelegate(,)

Install a delegate that handles input events. Removes any currently set direct callbacks

Parameters

delegate

The delegate to install

tag

Some legacy delegates use a tag to distinguish between inputs; this is a convenience parameter for setting the tag of the internal CCTextInputNode for those cases
voidsetCallback()

Set a direct callback function that is called when the user types in the input. Overrides any delegate that is currently installed

Parameters

onInput

Function to call when the user changes the value of the text input
voidsetEnabled(
boolenabled
)

Enable/disable the input

voidsetTextAlign()

Align the button’s content to the left. If false, aligns to the center

voidhideBG()

Hides the background of this input. Shorthand for input->getBGSprite()->setVisible(false)

voidsetString(,
booltriggerCallback
)

Set the value of the input

Parameters

str

The new text of the input

triggerCallback

Whether this should trigger the callback function / delegate's textChanged event or not
std::stringgetString()const

Get the current value of the input

voidfocus()

Focus this input (activate the cursor)

voiddefocus()

Defocus this input (deactivate the cursor)

CCTextInputNode*getInputNode()const
No description provided
cocos2d::extension::CCScale9Sprite*getBGSprite()const
No description provided
Fields0
Protected member functions2
boolinit(
floatwidth
,,)
No description provided
virtualvoidtextChanged()
No description provided
Protected fields4
;
No description provided
;
No description provided
;
No description provided
;
No description provided