#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

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

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

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


#API Documentation

#Functions

Signaturecp.ui.Button.matches(element) -> boolean
TypeFunction
DescriptionChecks 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.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/Button.lua line 18

#Constructors

Signaturecp.ui.Button(parent, uiFinder) -> cp.ui.Button
TypeConstructor
DescriptionCreates 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.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/Button.lua line 31

#Fields

Signaturecp.ui.Button.title <cp.prop: string; read-only>
TypeField
DescriptionThe button title, if available.
NotesNone
Sourcesrc/extensions/cp/ui/Button.lua line 45

#Methods

Signaturecp.ui.Button:doPress() -> cp.rx.go.Statement
TypeMethod
DescriptionReturns 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.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/Button.lua line 69

Signaturecp.ui.Button:press() -> self, boolean
TypeMethod
DescriptionPerforms a button press action, if the button is available.
Parameters
  • None
Returns
  • The Button instance.
  • true if the button was actually pressed successfully.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/Button.lua line 52