Button
Related: GUI
Button wraps a PluginToolbarButton created through GUI.createButton().
setEnabled()
Sets the toolbar button's Enabled state.
Type
ts
setEnabled(state: boolean): voidsetPressed()
Sets the button's active state and then fires registered onPress() callbacks with the updated state.
Type
ts
setPressed(state: boolean): voidonPress()
Registers a callback that runs whenever the button is pressed.
Type
ts
onPress(cb: (state: boolean) => void): ButtonNotes
stateis the current pressed state.- Non-toggleable buttons still invoke the callback, but the state stays
falseunless you callsetPressed()yourself. - Use View.linkButton() if the button should directly control a view.