# cp.ui.Button

The Button type extends Element and includes all its methods, fields and other properties.


# API Overview

Functions - API calls offered directly by the extension

  • matches

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

  • Button

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

  • title

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

  • doPress
  • press

# API Documentation

# Functions

# matches

Signature cp.ui.Button.matches(element) -> boolean
Type Function
Description Checks if the element is a Button, returning true if so.
Parameters
  • element - The hs.axuielement to check.
Returns
  • true if the element is a Button, or false if not.
Notes None
Examples None
Source src/extensions/cp/ui/Button.lua line 18

# Constructors

# Button

Signature cp.ui.Button(parent, uiFinder) -> cp.ui.Button
Type Constructor
Description Creates a new Button instance.
Parameters
  • parent - The parent object. Should have a UI and isShowing field.
  • uiFinder - A function which will return the hs.axuielement the button belongs to, or nil if not available.
Returns
  • The new Button instance.
Notes None
Examples None
Source src/extensions/cp/ui/Button.lua line 31

# Fields

# title

Signature cp.ui.Button.title <cp.prop: string; read-only>
Type Field
Description The button title, if available.
Notes None
Source src/extensions/cp/ui/Button.lua line 45

# Methods

# doPress

Signature cp.ui.Button:doPress() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will press the button when executed, if available at the time. If not an error is sent.
Parameters
  • None
Returns
  • The Statement which will press the button when executed.
Notes None
Examples None
Source src/extensions/cp/ui/Button.lua line 69

# press

Signature cp.ui.Button:press() -> self, boolean
Type Method
Description Performs a button press action, if the button is available.
Parameters
  • None
Returns
  • The Button instance.
  • true if the button was actually pressed successfully.
Notes None
Examples None
Source src/extensions/cp/ui/Button.lua line 52