Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
185 lines (158 loc) · 15.3 KB

cp.ui.MenuButton.md

File metadata and controls

185 lines (158 loc) · 15.3 KB

docs » cp.ui.MenuButton


Menu Button Module.

API Overview

API Documentation

Functions

Signature cp.ui.MenuButton.matches(element) -> boolean
Type Function
Description Checks to see if an element matches what we think it should be.
Parameters
  • element - An axuielementObject to check.
Returns
  • true if matches otherwise false

Constructors

Signature cp.ui.MenuButton(parent, uiFinder) -> MenuButton
Type Constructor
Description Creates a new MenuButton.
Parameters
  • parent - The parent object. Should have an isShowing property.
  • uiFinder - A cp.prop or function which will return a hs._asm.axuielement, or nil if it's not available.

Fields

Signature cp.ui.MenuButton.menuUI <cp.prop: hs._asm.axuielement; read-only; live?>
Type Field
Description Returns the AXMenu for the MenuButton if it is currently visible.
Signature cp.ui.MenuButton.title <cp.prop: string; read-only>
Type Field
Description Returns the title for the MenuButton.
Signature cp.ui.MenuButton.value <cp.prop: anything>
Type Field
Description Returns or sets the current MenuButton value.

Methods

Signature cp.ui.MenuButton:doPress() -> cp.rx.go.Statement
Type Method
Description A Statement that presses the MenuButton.
Parameters
  • None
Returns
Signature cp.ui.MenuButton:doSelectItem(index) -> cp.rx.go.Statement
Type Method
Description A Statement that will select an item on the MenuButton by index.
Parameters
  • index - The index number of the item to match.
Returns
  • the Statement.
Signature cp.ui.MenuButton:doSelectItemMatching(pattern[, altPattern]) -> cp.rx.go.Statement
Type Method
Description A Statement that will select an item on the MenuButton by pattern.
Parameters
  • pattern - The pattern to match.
  • [altPattern] - An optional alternate pattern to match if the first pattern fails.
Returns
  • the Statement.
Signature cp.ui.MenuButton:doSelectValue(value) -> cp.rx.go.Statement
Type Method
Description A Statement that will select an item on the MenuButton by value.
Parameters
  • value - The value of the item to match.
Returns
  • the Statement.
Signature cp.ui.MenuButton:doShowMenu() -> cp.rx.go.Statement
Type Method
Description A Statement that presses the MenuButton if the menu is not showing.
Parameters
  • None
Returns

| Signature | cp.ui.MenuButton:getTitle() -> string | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Gets the MenuButton title. | | Parameters |

  • None
| | Returns |
  • The MenuButton title as string, or nil if the title cannot be determined.
|

| Signature | cp.ui.MenuButton:getValue() -> string | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Gets the MenuButton value. | | Parameters |

  • None
| | Returns |
  • The MenuButton value as string, or nil if the value cannot be determined.
|

Signature cp.ui.MenuButton:loadLayout(layout) -> none
Type Method
Description Loads a MenuButton layout.
Parameters
  • layout - A table containing the MenuButton layout settings - created using saveLayout.
Returns
  • None
Signature cp.ui.MenuButton:press() -> self
Type Method
Description Presses the MenuButton.
Parameters
  • None
Returns
  • self
Signature cp.ui.MenuButton:saveLayout() -> table
Type Method
Description Saves the current MenuButton layout to a table.
Parameters
  • None
Returns
  • A table containing the current MenuButton Layout.
Signature cp.ui.MenuButton:selectItem(index) -> boolean
Type Method
Description Select an item on the MenuButton by index.
Parameters
  • index - The index of the item you want to select.
Returns
  • true if successfully selected, otherwise false.
Signature cp.ui.MenuButton:selectItemMatching(pattern) -> boolean
Type Method
Description Select an item on the MenuButton by pattern.
Parameters
  • pattern - A pattern used to select the MenuButton item.
Returns
  • true if successfully selected, otherwise false.
Signature cp.ui.MenuButton:setValue(value) -> self
Type Method
Description Sets the MenuButton value.
Parameters
  • value - The value you want to set the MenuButton to.
Returns
  • self
Signature cp.ui.MenuButton:show() -> self
Type Method
Description Show's the MenuButton.
Parameters
  • None
Returns
  • self