Files

1.9 KiB

UIComponent.y

← UIComponent · ← Master

Parça 4/7 · önceki · sonraki

} else if (key === "right") {

uiContext.get("icon").icon("rightload"); } }

context

public UIComponent context(java.lang.String icon, java.lang.String action, java.lang.String label)

Add a context menu item.

Parameters: icon - Icon ID (see UIIconButtonComponent). action - Action ID that will be used for handling with IMappetUIContext.getContext(). label - Label that will be displayed in the context menu item.

context

public UIComponent context(java.lang.String icon, java.lang.String action, java.lang.String label, int color)

Add a context menu item.

function main(c) { var ui = mappet.createUI(c, "handler").background(); var label = ui.label("Hello!").id("label").tooltip("Right click me...");

label.rxy(0.5, 0.5).wh(160, 20).anchor(0.5).labelAnchor(0.5); label.context("bubble", "a", "How are you?"); label.context("remove", "b", "...", 0xff0033);

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")); }

var item = uiContext.getContext();

if (item === "a") { uiContext.get("label").label("I'm fine, and you?"); } else if (item === "b") { uiContext.get("label").label(""); } }

Parameters: icon - Icon ID (see UIIconButtonComponent). action - Action ID that will be used for handling with IMappetUIContext.getContext(). label - Label that will be displayed in the context menu item. color - Background color highlight (in RGB hex format).

x

public UIComponent x(int value)

Set X in pixels relative to parent component.

rx