RadioButton

Radio Button Module.

This represents an hs._asm.axuielement with a AXRadioButton 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 RadioButton 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

  • 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

matches

Signature

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

Type

Function

Description

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

Parameters

Returns

Fields

checked

Signature

cp.ui.RadioButton.checked <cp.prop: boolean>

Type

Field

Description

Indicates if the checkbox is currently checked.

isShowing

Signature

cp.ui.RadioButton.isShowing <cp.prop: boolean; read-only>

Type

Field

Description

If true, it is visible on screen.

Methods

app

Signature

cp.ui.RadioButton:app() -> table

Type

Method

Description

Returns the application object, via the parent().

Parameters

Returns

isEnabled

Signature

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

Type

Method

Description

Returns true if the radio button exists and is enabled.

Parameters

Returns

true or false.

new

Signature

cp.ui.RadioButton.new(axuielement, function) -> RadioButton

Type

Method

Description

Creates a new RadioButton.

Parameters

Returns

parent

Signature

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

Type

Method

Description

The parent object.

Parameters

Returns

press

Signature

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

Type

Method

Description

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

Parameters

Returns

The RadioButton instance.

snapshot

Signature

`cp.ui.RadioButton: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.RadioButton:toggle() -> self

Type

Method

Description

Toggles the checked status of the button.

Parameters

Returns

UI

Signature

`cp.ui.RadioButton:UI() -> hs._asm.axuielement

nil` </span>

Type

Method

Description

Returns the axuielement representing the RadioButton, or nil if not available.

Parameters