Files

70 lines
1.7 KiB
Markdown

# UITextboxComponent — giriş
[← UITextboxComponent](index.md) · [← Master](../../wiki.md)
mchorse.mappet.api.ui.components
Class UITextboxComponent
java.lang.Object
mchorse.mappet.api.ui.components.UIComponent
mchorse.mappet.api.ui.components.UILabelBaseComponent
mchorse.mappet.api.ui.components.UITextboxComponent
public class UITextboxComponent
extends UILabelBaseComponent
Textbox UI component.
This component allows users to input a text line (for multi-line input use UITextareaComponent component). This could
be used to request the player to input names.
The value that gets written to UI context's data (if ID is present) is the string that user typed into the component.
This component can be created using IMappetUIBuilder.textbox() method.
function main(c)
{
var ui = mappet.createUI(c, "handler").background();
var textbox = ui.textbox().id("textbox").tooltip("Enter your name:");
textbox.rxy(0.5, 0.5).wh(160, 20).anchor(0.5);
c.getSubject().openUI(ui);
}
function handler(c)
{
var uiContext = c.getSubject().getUIContext();
var data = uiContext.getData();
if (uiContext.getLast() === "textbox")
{
c.getSubject().send("Your name is: " + data.getString("textbox"));
}
}
Field Summary
Fields
Field and Description
Modifier and Type
int maxLength
Fields inherited from
class mchorse.mappet.api.ui.components.UILabelBaseComponent
hasBackground, label
Fields inherited from class mchorse.mappet.api.ui.components.UIComponent
changedProperties, context, DELAY, enabled, h, id, keybinds, marginBottom, marginLeft, marginRight, marginTop,
tooltip, tooltipDirection, updateDelay, visible, w, x, y
Constructor Summary
Constructors
Constructor and Description