#cp.ui.DisclosureTriangle

Disclosure Triangle UI Module.

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

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

You can also call instances of DisclosureTriangle as a function, which will return the opened 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.DisclosureTriangle.matches(element) -> boolean
TypeFunction
DescriptionChecks if the provided hs.axuielement is a DisclosureTriangle.
Parameters
  • element - The axuielement to check.
Returns
  • true if it's a match, or false if not.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/DisclosureTriangle.lua line 36

#Constructors

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

#Fields

Signaturecp.ui.DisclosureTriangle.opened <cp.prop: boolean>
TypeField
DescriptionIndicates if the disclosure triangle is currently opened.
NotesNone
Sourcesrc/extensions/cp/ui/DisclosureTriangle.lua line 70

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

#Methods

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

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

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

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

Signaturecp.ui.DisclosureTriangle: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/DisclosureTriangle.lua line 214

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

Signaturecp.ui.DisclosureTriangle:saveLayout() -> table
TypeMethod
DescriptionReturns a table containing the layout settings. 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/DisclosureTriangle.lua line 199

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