#cp.ui.CheckBox

Check Box UI Module.

This represents an hs.axuielement with a AXCheckBox role. It allows checking and modifying the checked status like so:

myButton:checked() == true -- happens to be checked already myButton:checked(false) == false -- update to unchecked. myButton.checked:toggle() == true -- toggled back to being checked.

You can also call instances of CheckBox as a function, which will return the checked status:

myButton() == true -- still true myButton(false) == false -- now false

#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.CheckBox.matches(element) -> boolean
TypeFunction
DescriptionChecks if the provided hs.axuielement is a CheckBox.
Parameters
  • element - The axuielement to check.
Returns
  • true if it's a match, or false if not.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 36

#Constructors

Signaturecp.ui.CheckBox(parent, uiFinder) -> cp.ui.CheckBox
TypeConstructor
DescriptionCreates a new CheckBox.
Parameters
  • parent - The parent object.
  • uiFinder - A function which will return the hs.axuielement when available.
Returns
  • The new CheckBox.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 49

#Fields

Signaturecp.ui.CheckBox.checked <cp.prop: boolean>
TypeField
DescriptionIndicates if the checkbox is currently checked.
NotesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 70

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

#Methods

Signaturecp.ui.CheckBox:click() -> self
TypeMethod
DescriptionPerforms a single mouse click on the checkbox.
Parameters
  • None
Returns
  • The CheckBox instance.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 89

Signaturecp.ui.CheckBox:doCheck() -> cp.rx.go.Statement
TypeMethod
DescriptionReturns a Statement that will ensure the CheckBox is checked.
Parameters
  • None
Returns
  • A Statement
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 161

Signaturecp.ui.CheckBox: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/CheckBox.lua line 140

Signaturecp.ui.CheckBox:doUncheck() -> cp.rx.go.Statement
TypeMethod
DescriptionReturns a Statement that will ensure the CheckBox is unchecked.
Parameters
  • None
Returns
  • A Statement
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 180

Signaturecp.ui.CheckBox:loadLayout(layout) -> nil
TypeMethod
DescriptionApplies the settings in the provided layout table.
Parameters
  • layout - The table containing layout settings. Usually created by the saveLayout method.
Returns
  • nil
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 214

Signaturecp.ui.CheckBox:press() -> self
TypeMethod
DescriptionAttempts to press the button. May fail if the UI is not available.
Parameters
  • None
Returns
  • The CheckBox instance.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 123

Signaturecp.ui.CheckBox:saveLayout() -> table
TypeMethod
DescriptionReturns a table containing the layout settings for the checkbox. This table may be passed to the loadLayout method to restore the saved layout.
Parameters
  • None
Returns
  • A settings table.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 199

Signaturecp.ui.CheckBox:toggle() -> self
TypeMethod
DescriptionToggles the checked status of the button.
Parameters
  • None
Returns
  • The CheckBox instance.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/CheckBox.lua line 109