Internationalisation
Bundled Plugins API
DisclosureTriangle
Disclosure Triangle UI Module.
This represents an hs._asm.axuielement with a AXDisclosureTriangle role. It allows checking and modifying the opened status like so:
1
myButton:opened() == true -- happens to be opened already
2
myButton:opened(false) == false -- update to unopened.
3
myButton.opened:toggle() == true -- toggled back to being opened.
Copied!
You can also call instances of DisclosureTriangle as a function, which will return the opened status:
1
myButton() == true -- still true
2
myButton(false) == false -- now false
Copied!

API Overview

  • Functions - API calls offered directly by the extension
  • matches
  • 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
  • opened
  • title
  • Methods - API calls which can only be made on an object returned by a constructor
  • click
  • doClose
  • doOpen
  • doPress
  • press
  • toggle

API Documentation

Functions

matches

Signature
cp.ui.DisclosureTriangle.matches(element) -> boolean
Type
Function
Description
Checks if the provided hs._asm.axuielement is a DisclosureTriangle.
Parameters
  • element - The axuielement to check.
Returns
  • true if it's a match, or false if not.

Constructors

Signature
cp.ui.DisclosureTriangle(parent, uiFinder) -> cp.ui.DisclosureTriangle
Type
Constructor
Description
Creates a new DisclosureTriangle.
Parameters
  • parent - The parent object.
  • uiFinder - A function which will return the hs._asm.axuielement when available.
Returns
  • The new DisclosureTriangle.

Fields

opened

Signature
cp.ui.DisclosureTriangle.opened <cp.prop: boolean>
Type
Field
Description
Indicates if the disclosure triangle is currently opened.

title

Signature
cp.ui.DisclosureTriangle.title <cp.prop: string; read-only>
Type
Field
Description
The button title, if available.

Methods

click

Signature
cp.ui.DisclosureTriangle:click() -> self
Type
Method
Description
Performs a single mouse click on the triangle.
Parameters
  • None
Returns
  • The DisclosureTriangle instance.

doClose

Signature
cp.ui.DisclosureTriangle:doClose() -> cp.rx.go.Statement
Type
Method
Description
Returns a Statement that will ensure the DisclosureTriangle is unopened.

doOpen

Signature
cp.ui.DisclosureTriangle:doOpen() -> cp.rx.go.Statement
Type
Method
Description
Returns a Statement that will ensure the DisclosureTriangle is opened.

doPress

Signature
cp.ui.DisclosureTriangle:doPress() -> cp.rx.go.Statement
Type
Method
Description
Returns a Statement that will press the button when executed, if available at the time.
Parameters
  • None
Returns
  • The Statement which will press the button when executed.
Signature
cp.ui.DisclosureTriangle: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

press

Signature
cp.ui.DisclosureTriangle:press() -> self
Type
Method
Description
Attempts to press the button. May fail if the UI is not available.
Parameters
  • None
Returns
The DisclosureTriangle instance.
Signature
cp.ui.DisclosureTriangle:saveLayout() -> table
Type
Method
Description
Returns a table containing the layout settings.
Parameters
  • None
Returns
  • A settings table.

toggle

Signature
cp.ui.DisclosureTriangle:toggle() -> self
Type
Method
Description
Toggles the opened status of the button.
Parameters
  • None
Returns
  • The DisclosureTriangle instance.
Last modified 1mo ago