Files

66 lines
1.8 KiB
Markdown

# UITextareaComponent — giriş
[← UITextareaComponent](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](_giris-2.md)
mchorse.mappet.api.ui.components
Class UITextareaComponent
java.lang.Object
mchorse.mappet.api.ui.components.UIComponent
mchorse.mappet.api.ui.components.UILabelBaseComponent
mchorse.mappet.api.ui.components.UITextareaComponent
public class UITextareaComponent
extends UILabelBaseComponent
Text area UI component.
This component allows users to input multiple lines of text (for single-line input use UITextboxComponent component).
This could be used to let players input a multi-line description about themselves.
The value that gets written to UI context's data (if ID is present) is the multi-line string that user typed into the
component.
This component can be created using IMappetUIBuilder.textarea(String) method.
function main(c)
{
var s = c.getSubject();
var story = s.getStates().getString("story");
var ui = mappet.createUI(c, "handler").background();
var textarea = ui.textarea(story).id("textarea").tooltip("Tell us your story...");
// Don't send updates too often, only half a second after the player
// stopped typing into a text area
textarea.updateDelay(500);
textarea.rxy(0.5, 0.5).wh(300, 200).anchor(0.5);
s.openUI(ui);
}
function handler(c)
{
var uiContext = c.getSubject().getUIContext();
var data = uiContext.getData();
if (uiContext.getLast() === "textarea")
{
// Write down the input
c.getSubject().getStates().setString("story", data.getString("textarea"));
}
}
Field Summary
Fields inherited from
class mchorse.mappet.api.ui.components.UILabelBaseComponent
hasBackground, label
Fields inherited from class mchorse.mappet.api.ui.components.UIComponent