GaldurSearchField
classclient onlysince 0.1.0com.galdurstudio.galdurui.api.widget.GaldurSearchField
Themed search field, usable in vanilla layouts.
Text editing itself (cursor, selection, copy and paste, Ctrl+A, text that scrolls when it
overflows) is handled by a vanilla EditBox placed inside: Galdur UI draws the frame,
the placeholder and the colours, and forwards mouse and keyboard to the edit box.
Like GaldurCheckbox, the widget does not own the text: it reads it every
frame from a supplier and reports every keystroke. The text survives the widget being
rebuilt, and code can change it at any time.
String[] search = {""};column.addChild(GaldurSearchField.of(120, Component.literal("Search..."), () -> search[0], text -> search[0] = text));- Placeholder: shown in a muted colour while the field is empty.
- Disabled (
active = false): muted text, no input. - Escape closes the screen, as everywhere in the game; the up and down arrows move to the neighbouring widget.
Height from the theme: spacing.field_height. The text is limited to
256 characters.
Fields 1
MAX_LENGTH
staticMaximum length of the typed text.
Constructors 1
GaldurSearchField
protectedPrefer of().
PARAMETERS
Methods 3
of
staticPARAMETERS
RETURNSGaldurSearchField — a search field at (0, 0), for a layout to place
preferredWidth
staticPARAMETERS
RETURNSint — the width that shows the placeholder in full, or minWidth if larger
playDownSound
A text field does not play the button sound when clicked.
PARAMETERS