Files

1.8 KiB

UITrackpadComponent — giriş

← UITrackpadComponent · ← Master

Parça 1/2 · sonraki

mchorse.mappet.api.ui.components

Class UITrackpadComponent java.lang.Object

mchorse.mappet.api.ui.components.UIComponent mchorse.mappet.api.ui.components.UITrackpadComponent

public class UITrackpadComponent extends UIComponent

Trackpad UI component.

This component allows users to input numerical values (integer and double), with optionally a limit range between min and max. Users can also use arrow buttons on the side to increment and decrement the value, and type in value manually.

The value that gets written to UI context's data (if ID is present) is the number displayed in the field, if integer option is enabled, then an integer will be written, or double if it's disabled.

This component can be created using IMappetUIBuilder.trackpad() method.

function main(c) { var ui = mappet.createUI(c, "handler").background(); var trackpad = ui.trackpad(5).id("number").limit(0, 25, true);

trackpad.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() === "number") { // If integer wasn't enabled, you would use: // data.getDouble("number") if (data.getInt("number") === 19) { c.getSubject().send("21"); } } }

Field Summary Fields

Modifier and Type Field and Description java.lang.Double increment boolean integer java.lang.Double max java.lang.Double min java.lang.Double normal java.lang.Double strong java.lang.Double value java.lang.Double weak

Fields inherited from class mchorse.mappet.api.ui.components.UIComponent