PluginToolbarButton
Memory category | Instances |
---|
Member index 7
Description
A PluginToolbarButton is an object created by the PluginToolbar:CreateButton() function. It allows the user to initiate a single, one-off action in Roblox Studio through the Click event.
When pressed, the Click event fires. A button will also remain in the pressed state, which may be set manually using SetActive. Upon plugin activation (Plugin:Activate()), buttons in all other PluginToolbars will be toggled off. If all buttons in a toolbar are off, the toolbar's plugin is deactivated (Plugin:Deactivate()).
When the game viewport is not visible, buttons will be disabled as if their Enabled property were false. Disabled buttons are desaturated and do not respond to user clicks. By setting ClickableWhenViewportHidden to true, you can allow plugin buttons to remain clickable (such as during script editing).
History 21
- 645 Change ValueType of Icon from Content to ContentId
- 630 Add SetDropdownActive
- 589 Add DropdownClick
- 573 Change ReturnType of SetActive from void to null
- 553 Change Default of Icon from to
- 553 Change Default of Enabled from to
- 553 Change Default of ClickableWhenViewportHidden from to
- 486 Change ThreadSafety of Icon from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Enabled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ClickableWhenViewportHidden from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Click from to Unsafe
- 462 Change ThreadSafety of SetActive from to Unsafe
- 462 Change ThreadSafety of Icon from to ReadOnly
- 462 Change ThreadSafety of Enabled from to ReadOnly
- 462 Change ThreadSafety of ClickableWhenViewportHidden from to ReadOnly
- 367 Add Click
- 367 Add SetActive
- 367 Add Icon
- 367 Add Enabled
- 367 Add ClickableWhenViewportHidden
- 367 Add PluginToolbarButton
Members 7
Click
Parameters (0) | ||
---|---|---|
No parameters. |
Click fires when the PluginToolbarButton is pressed and released by the user.
Clicking a PluginToolbarButton causes the state of the button to toggle. Call SetActive to manually set the state of the button.
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
ClickableWhenViewportHidden
Type | Default | |
---|---|---|
bool |
ClickableWhenViewportHidden determines whether a PluginToolbarButton may be clicked while the game viewport is hidden, such as when a Script is being edited in another tab.
Typically, this property is good to enable if an action triggered by a plugin button's Click event doesn't occur in the game world (Workspace). For example, a button that opens a widget should have this property be true, as showing a widget is visible to the user even if the game view isn't visible.
Thread safety | ReadSafe |
---|---|
Category | Appearance |
Loaded/Saved | true/false |
History 4
- 553 Change Default of ClickableWhenViewportHidden from to
- 486 Change ThreadSafety of ClickableWhenViewportHidden from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ClickableWhenViewportHidden from to ReadOnly
- 367 Add ClickableWhenViewportHidden
DropdownClick
Parameters (0) | ||
---|---|---|
No parameters. |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 589 Add DropdownClick
Enabled
Type | Default | |
---|---|---|
bool |
Enabled determines whether a button is clickable in general. When this property is false, the button will be greyed out and unclickable, preventing the user from firing the Click event. Buttons are enabled by default.
When re-enabling this property, the plugin button's state won't be remembered from the previous state in which the user left the button in. Instead, it will default to the last state set by SetActive() or to the inactive state if SetActive() was never used.
Plugins should disable their buttons when the button action isn't relevant in the current context. For example, a plugin button that assigns random colors to selected should not be enabled when the selection contains no parts. See the code samples for more information.
See also:
- ClickableWhenViewportHidden, which determines whether a button is clickable when the game view is hidden (and not just in general)
Thread safety | ReadSafe |
---|---|
Category | Appearance |
Loaded/Saved | true/false |
Icon
Type | Default | |
---|---|---|
ContentId |
Icon determines what icon should be shown for the button in the plugin toolbar. When this property is not set, the button will instead use the button's text given by PluginToolbar:CreateButton().
Thread safety | ReadSafe |
---|---|
Category | Appearance |
Loaded/Saved | true/false |
SetActive
Parameters (1) | ||
---|---|---|
active | bool | |
Returns (1) | ||
null |
This method can be used to manually set the active state of the plugin button.
When the Enabled property is toggled back on, the button will either revert to the last state set by this method or default to inactive if this method hasn't been used previously.
Security | PluginSecurity |
---|---|
Thread safety | Unsafe |
SetDropdownActive
Parameters (1) | ||
---|---|---|
active | bool | |
Returns (1) | ||
null |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
- 630 Add SetDropdownActive