# 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

  • matches

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

  • DisclosureTriangle

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
  • loadLayout
  • press
  • saveLayout
  • toggle

# API Documentation

# Functions

# matches

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

# Constructors

# DisclosureTriangle

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.axuielement when available.
Returns
  • The new DisclosureTriangle.
Notes None
Examples None
Source src/extensions/cp/ui/DisclosureTriangle.lua line 49

# Fields

# opened

Signature cp.ui.DisclosureTriangle.opened <cp.prop: boolean>
Type Field
Description Indicates if the disclosure triangle is currently opened.
Notes None
Source src/extensions/cp/ui/DisclosureTriangle.lua line 70

# title

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

# 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.
Notes None
Examples None
Source src/extensions/cp/ui/DisclosureTriangle.lua line 89

# doClose

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

# doOpen

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

# 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. 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/DisclosureTriangle.lua line 140

# loadLayout

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
Notes None
Examples None
Source src/extensions/cp/ui/DisclosureTriangle.lua line 214

# 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.
Notes None
Examples None
Source src/extensions/cp/ui/DisclosureTriangle.lua line 123

# saveLayout

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

# toggle

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