CheckBox

Last updated 8 months ago

Check Box UI Module.

This represents an hs._asm.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

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

API Documentation

Functions

matches

Signature

cp.ui.CheckBox.matches(element) -> boolean

Type

Function

Description

Checks if the provided hs._asm.axuielement is a CheckBox.

Parameters

Returns

Constructors

new

Signature

cp.ui.CheckBox.new(parent, finderFn) -> cp.ui.CheckBox

Type

Constructor

Description

Creates a new CheckBox.

Parameters

Returns

Methods

isEnabled

Signature

cp.ui.CheckBox:isEnabled() -> boolean

Type

Method

Description

Returns true if the radio button exists and is enabled.

Parameters

Returns

true or false.

Signature

cp.ui.CheckBox:loadLayout(layout) -> nil

Type

Method

Description

Applies the settings in the provided layout table.

Parameters

Returns

parent

Signature

cp.ui.CheckBox:parent() -> table

Type

Method

Description

The parent object.

Parameters

Returns

press

Signature

cp.ui.CheckBox:press() -> self

Type

Method

Description

Attempts to press the button. May fail if the UI is not available.

Parameters

Returns

The CheckBox instance.

Signature

cp.ui.CheckBox:saveLayout() -> table

Type

Method

Description

Returns a table containing the layout settings for the checkbox.

Parameters

Returns

snapshot

Signature

`cp.ui.CheckBox:snapshot([path]) -> hs.image

nil` </span>

Type

Method

Description

Takes a snapshot of the UI in its current state as a PNG and returns it.

Parameters

toggle

Signature

cp.ui.CheckBox:toggle() -> self

Type

Method

Description

Toggles the checked status of the button.

Parameters

Returns