# cp.ui.PopUpButton

Pop Up Button Module.


# API Overview

Functions - API calls offered directly by the extension

  • matches

Constructors - API calls which return an object, typically one that offers API methods

  • PopUpButton

Fields - Variables which can only be accessed from an object returned by a constructor

  • menuUI
  • value

Methods - API calls which can only be made on an object returned by a constructor

  • doPress
  • doSelectItem
  • doSelectValue
  • getValue
  • loadLayout
  • press
  • saveLayout
  • selectItem
  • setValue

# API Documentation

# Functions

# matches

Signature cp.ui.PopUpButton.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
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 24

# Constructors

# PopUpButton

Signature cp.ui.PopUpButton(parent, uiFinder) -> cp.ui.PopUpButton
Type Constructor
Description Creates a new PopUpButton.
Parameters
  • parent - The parent table. Should have a isShowing property.
  • uiFinder - The function or cp.prop that provides the current hs.axuielement.
Returns
  • The new PopUpButton instance.
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 37

# Fields

# menuUI

Signature cp.ui.PopUpButton.menuUI <cp.prop: hs.axuielement; read-only; live?>
Type Field
Description Returns the AXMenu for the PopUpMenu if it is currently visible.
Notes None
Source src/extensions/cp/ui/PopUpButton.lua line 81

# value

Signature cp.ui.PopUpButton.value <cp.prop: anything; live>
Type Field
Description Returns or sets the current PopUpButton value.
Notes None
Source src/extensions/cp/ui/PopUpButton.lua line 48

# Methods

# doPress

Signature cp.ui.PopUpButton:doPress() -> cp.rx.go.Statement
Type Method
Description A Statement that presses the PopUpButton.
Parameters
  • None
Returns
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 235

# doSelectItem

Signature cp.ui.PopUpButton:doSelectItem(index) -> cp.rx.go.Statement
Type Method
Description A Statement that will select an item on the PopUpButton by index.
Parameters
  • index - The index number of the item you want to select.
Returns
  • the Statement.
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 124

# doSelectValue

Signature cp.ui.PopUpButton:doSelectValue(value, [overrideValue]) -> cp.rx.go.Statement
Type Method
Description A Statement that will select an item on the PopUpButton by value.
Parameters
  • value - The value of the item to match.
  • overrideValue - This optional value overides the above value for the initial compare as a workaround for PopUp that have titles that don't update correctly.
Returns
  • the Statement.
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 152

# getValue

Signature cp.ui.PopUpButton:getValue() -> string | nil
Type Method
Description Gets the PopUpButton value.
Parameters
  • None
Returns
  • The PopUpButton value as string, or nil if the value cannot be determined.
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 191

# loadLayout

Signature cp.ui.PopUpButton:loadLayout(layout) -> none
Type Method
Description Loads a PopUpButton layout.
Parameters
  • layout - A table containing the PopUpButton layout settings - created using saveLayout.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 283

# press

Signature cp.ui.PopUpButton:press() -> self
Type Method
Description Presses the PopUpButton.
Parameters
  • None
Returns
  • self
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 218

# saveLayout

Signature cp.ui.PopUpButton:saveLayout() -> table
Type Method
Description Saves the current PopUpButton layout to a table.
Parameters
  • None
Returns
  • A table containing the current PopUpButton Layout.
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 268

# selectItem

Signature cp.ui.PopUpButton:selectItem(index) -> self
Type Method
Description Select an item on the PopUpButton by index.
Parameters
  • index - The index of the item you want to select.
Returns
  • self
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 97

# setValue

Signature cp.ui.PopUpButton:setValue(value) -> self
Type Method
Description Sets the PopUpButton value.
Parameters
  • value - The value you want to set the PopUpButton to.
Returns
  • self
Notes None
Examples None
Source src/extensions/cp/ui/PopUpButton.lua line 204