For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

SetToolbarItemEnabled()

Enables or disables a top-level item in a toolbar.

Use this function to make a toolbar button or toolbar menu available only when the corresponding action can currently be used.

Syntax

SetToolbarItemEnabled(toolbarHandle, itemId, enabled)

Parameters

toolbarHandle

Type: integer

Handle of the toolbar which contains the item.

itemId

Type: string

Id of the top-level toolbar item to enable or disable.

enabled

Type: boolean

Set to true to enable the item.

Set to false to disable the item.

Return value

This function does not return a value.

Remarks

SetToolbarItemEnabled() applies to top-level toolbar items only. This includes toolbar buttons and toolbar menus.

If you need to enable or disable an item inside a menu, use the menu item functions instead.

The enabled state is a presentation state. Your add-on should still keep its own state and decide when an action is valid.

A common pattern is to update toolbar items after recomputing the data they depend on. For example, an Export button can be enabled only when there is valid data to export.

Example

This keeps the Export button disabled until the analysis data is valid.

Last updated