TabletButtonProxy

Description

A tablet button. In toolbar mode (Developer > UI > Tablet Becomes Toolbar), the tablet button is displayed on the toolbar.

Create a new button using TabletProxy#addButton.

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts

Constructor
new TabletButtonProxy( )

Properties

Name Type Summary
uuid Uuid The ID of the button. Read-only.
properties TabletButtonProxy.ButtonProperties The current values of the button's properties. Only properties that have been set during button creation or subsequently edited are returned. Read-only.

Methods

Name Return Value Summary
editProperties None Changes the values of the button's properties.
getProperties TabletButtonProxy.ButtonProperties Gets the current values of the button's properties. Only properties that have been set during button creation or subsequently edited are returned.

Signals

Name Summary
clicked Triggered when the button is clicked.
propertiesChanged Triggered when a button's properties are changed.

Type Definitions

ButtonProperties
Type: object

Properties of a tablet button.

Properties

Name Type Summary
uuid Uuid The button ID. Read-only.
objectName Uuid Synonym for uuid.
stableOrder number The order in which the button was created: each button created gets a value incremented by one.
icon string The url of the default button icon displayed. (50 x 50 pixels. SVG, PNG, or other image format.)
hoverIcon string The url of the button icon displayed when the button is hovered and not active.
activeIcon string The url of the button icon displayed when the button is active.
activeHoverIcon string The url of the button icon displayed when the button is hovered and active.
text string The button caption.
hoverText string The button caption when the button is hovered and not active.
activeText string The button caption when the button is active.
activeHoverText string The button caption when the button is hovered and active.
captionColor string The color of the button caption.

Default Value: "#ffffff"

isActive boolean true if the button is active, false if it isn't.

Default Value: false

isEntered boolean true if the button is being hovered, false if it isn't.
buttonEnabled boolean true if the button is enabled, false if it is disabled.

Default Value: true

sortOrder number Determines the order of the buttons: buttons with lower numbers appear before buttons with larger numbers.

Default Value: 100

inDebugMode boolean If true and the tablet is being used, the button's isActive state toggles each time the button is clicked. Tablet only.
flickable object Internal tablet-only property.
gridView object Internal tablet-only property.
buttonIndex number Internal tablet-only property.

Method Details

editProperties( properties )

Changes the values of the button's properties.

Parameters

Name Type Description
properties TabletButtonProxy.ButtonProperties The properties to change.
Example

Set a button's hover text after a delay.

var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({ text: "TEST" });

button.propertiesChanged.connect(function () {
    print("TEST button properties changed");
});

Script.setTimeout(function () {
    button.editProperties({ text: "CHANGED" });
}, 2000);

Script.scriptEnding.connect(function () {
    tablet.removeButton(button);
});
getProperties( ) → {TabletButtonProxy.ButtonProperties}
Returns: The button properties.

Gets the current values of the button's properties. Only properties that have been set during button creation or subsequently edited are returned.

Example

Report a test button's properties.

var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({ text: "TEST" });

var properties = button.getProperties();
print("TEST button properties: " + JSON.stringify(properties));

Script.scriptEnding.connect(function () {
    tablet.removeButton(button);
});

Signal Details

clicked( )
Returns: Signal

Triggered when the button is clicked.

Example

Report a menu button click.

var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({ text: "TEST" });

button.clicked.connect(function () {
    print("TEST button clicked");
});

Script.scriptEnding.connect(function () {
    tablet.removeButton(button);
});
propertiesChanged( )
Returns: Signal

Triggered when a button's properties are changed.