# 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

  • matches

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

  • CheckBox

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

  • checked
  • title

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

  • click
  • doCheck
  • doPress
  • doUncheck
  • loadLayout
  • press
  • saveLayout
  • toggle

# API Documentation

# Functions

# matches

Signature cp.ui.CheckBox.matches(element) -> boolean
Type Function
Description Checks 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.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 36

# Constructors

# CheckBox

Signature cp.ui.CheckBox(parent, uiFinder) -> cp.ui.CheckBox
Type Constructor
Description Creates a new CheckBox.
Parameters
  • parent - The parent object.
  • uiFinder - A function which will return the hs.axuielement when available.
Returns
  • The new CheckBox.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 49

# Fields

# checked

Signature cp.ui.CheckBox.checked <cp.prop: boolean>
Type Field
Description Indicates if the checkbox is currently checked.
Notes None
Source src/extensions/cp/ui/CheckBox.lua line 70

# title

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

# Methods

# click

Signature cp.ui.CheckBox:click() -> self
Type Method
Description Performs a single mouse click on the checkbox.
Parameters
  • None
Returns
  • The CheckBox instance.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 89

# doCheck

Signature cp.ui.CheckBox:doCheck() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will ensure the CheckBox is checked.
Parameters
  • None
Returns
  • A Statement
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 161

# doPress

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

# doUncheck

Signature cp.ui.CheckBox:doUncheck() -> cp.rx.go.Statement
Type Method
Description Returns a Statement that will ensure the CheckBox is unchecked.
Parameters
  • None
Returns
  • A Statement
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 180

# loadLayout

Signature cp.ui.CheckBox:loadLayout(layout) -> nil
Type Method
Description Applies the settings in the provided layout table.
Parameters
  • layout - The table containing layout settings. Usually created by the saveLayout method.
Returns
  • nil
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 214

# press

Signature cp.ui.CheckBox:press() -> self
Type Method
Description Attempts to press the button. May fail if the UI is not available.
Parameters
  • None
Returns
  • The CheckBox instance.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 123

# saveLayout

Signature cp.ui.CheckBox:saveLayout() -> table
Type Method
Description Returns 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.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 199

# toggle

Signature cp.ui.CheckBox:toggle() -> self
Type Method
Description Toggles the checked status of the button.
Parameters
  • None
Returns
  • The CheckBox instance.
Notes None
Examples None
Source src/extensions/cp/ui/CheckBox.lua line 109