MenuItem

Menu item.

Modulerequire("gui")
TypeClass

Class methods

create(type)

Create a menu item with type.

Parameters

Return

MenuItem

create(options)

Create a menu item with options.

Parameters

Return

MenuItem

Methods

click()

Emulate user clicking the menu item.

setLabel(label)

Change the item's label.

Parameters

getLabel()

Return the item's label.

Return

String

setSubmenu(submenu)

Set the submenu attached to the item.

This method only works for submenu type menu items.

Parameters

getSubmenu()

Return the submenu attached to the item.

Return

Menu

setChecked(checked)

Set the checked state of the item.

This method only works for radio and checkbox type menu items.

Parameters

isChecked()

Return the checked state of the item.

Return

Boolean

setEnabled(enabled)

Enable/disable the item.

Parameters

isEnabled()

Return whether the item is enabled.

Return

Boolean

setVisible(visible)

Show/hide the item.

Parameters

isVisible()

Return whether the item is visible to users.

Return

Boolean

setAccelerator(accelerator)

Set the accelerator used to activate the item.

Parameters

setImage(image) macOS Windows

Set the item's image.

Parameters

getImage() macOS Windows

Return the item's image.

Return

Image

Events

onClick(self)

Emitted when item is clicked.

Parameters

Preventable

No.

Delegates

validate(self)

Called before the item shows or activates, should return whether the item is enabled.

Parameters

Return

Boolean