A single-line text input node
Class TextInput
#include <Geode/ui/TextInput.hpp>
Examples0
Public static methods1
staticgeode::TextInput*create(floatwidth,std::stringconst&placeholder,)
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
width
placeholder
font
Public member functions18
voidsetPlaceholder(std::stringconst&placeholder)
Set the placeholder label for this input
voidsetLabel(std::stringconst&label)
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
allowedChars
voidsetCommonFilter(geode::CommonFilterfilter)
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(TextInputDelegate*delegate,)
Install a delegate that handles input events. Removes any currently set direct callbacks
delegate
tag
voidsetCallback()
Set a direct callback function that is called when the user types in the input. Overrides any delegate that is currently installed
onInput
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
str
triggerCallback
std::stringgetString()const
Get the current value of the input
voidfocus()
Focus this input (activate the cursor)
voiddefocus()
Defocus this input (deactivate the cursor)