Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
221 lines (189 loc) · 20.2 KB

cp.ui.Grid.md

File metadata and controls

221 lines (189 loc) · 20.2 KB

docs » cp.ui.Grid


Abstract base class for AX elements which form a grid, such as Table2 and Outline.

API Overview

API Documentation

Functions

Signature cp.ui.Grid.is(thing) -> boolean
Type Function
Description Checks if the thing is a Grid.
Parameters
  • thing - The thing to check
Returns
  • true if the thing is a Table instance.
Signature cp.ui.Grid.matches(element) -> boolean
Type Function
Description Checks if the element is an Grid.

Constructors

Signature cp.ui.Grid(parent, uiFinder) -> cp.ui.Grid
Type Constructor
Description Creates a new Grid with the specified parent and uiFinder.
Parameters
  • parent - The parent instance.
  • uiFinder - A function or a cp.prop which will return the axuielement.
Returns
  • The new Grid instance.

Fields

Signature cp.ui.Grid.selectedRows <cp.prop: table of cp.ui.Row; live?>
Type Field
Description Contains the list of currently-selected Rows. Can be set.
Signature cp.ui.Grid.selectedRowsUI <cp.prop: table of axuielement; live?>
Type Field
Description Contains the list of currently-selected row axuilements. Can be set.
Notes
  • Also see [#selectedRows]

Methods

Signature cp.ui.Grid:childrenUI() -> table of axuielements
Type Method
Description Provides a table containing the axuielements which are children of the outline.
Signature cp.ui.Grid:column(index) -> cp.ui.Column or nil
Type Method
Description Provides the Column at the specified index, or nil if it's not available.
Signature cp.ui.Grid:columns() -> table of cp.ui.Columns
Type Method
Description Returns the list of Columns.
Signature cp.ui.Grid:columnsUI() -> table of axuielements
Type Method
Description Provides a table containing the axuielements which are columns of the outline.
Signature cp.ui.Grid:createColumn(columnUI) -> cp.ui.Column
Type Method
Description Attempts to create a new Column with the provided columnUI axuielement.
Parameters
  • columnUI - the AXColumn axuielement to create a Column for.
Returns
  • The Column or an error if a problem occurred.
Notes
  • Subclasses which want to provide a custom Column implementation should override this method.
Signature cp.ui.Grid:createRow(rowUI) -> cp.ui.Row
Type Method
Description Attempts to create a new Row with the provided rowUI axuielement.
Parameters
  • rowUI - the AXRow axuielement to create a Row for.
Returns
  • The Row or an error if a problem occurred.
Notes
  • Subclasses which want to provide a custom Row implementation should override this method.
Signature cp.ui.Grid:doSelectRow(path) -> [Statement](cp.rx.go.Statement.md)
Type Method
Description Selects the row at the sub-level named in the path table.
Parameters
  • path - A table of names to navigate through to find the Row to select.
Returns
  • The selected Row, or nil if not found.
Signature cp.ui.Grid:fetchColumn(columnsUI) -> table of cp.ui.Columns
Type Method
Description Returns a table of the same length as columnsUI.
Parameters
  • columnsUI - The list of AXColumn axuielements to find.
Returns
  • A table with the same number of elements, containing the matching Column instances.
Signature cp.ui.Grid:fetchRow(rowUI) -> cp.ui.Row or nil
Type Method
Description Returns the Row that represents the provided rowUI, if it is actually present.
Parameters
  • rowUI - The axuielement for the AXRow to find a Row for.
Returns
  • The Row, or nil if the rowUI is not available.
Signature cp.ui.Grid:fetchRows(rowsUI) -> table of cp.ui.Rows
Type Method
Description Returns a table of the same length as rowsUI.
Parameters
  • rowsUI - The list of AXRow axuielements to find.
Returns
  • A table with the same number of elements, containing the matching Row instances.
Signature cp.ui.Grid:filterRows(matcherFn) -> table of cp.ui.Rows or nil
Type Method
Description Returns a table only containing Rows which pass the predicate matcherFn.
Parameters
  • matcherFn - the function that will accept a Row and return a boolean.
Returns
  • A table of Rows, or nil if no UI is currently available.

| Signature | cp.ui.Grid:findCell(rowNumber, columnId) -> hs._asm.axuielement | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Finds a specific Cell. | | Parameters |

  • rowNumber - The row number.
  • columnId - The Column ID.
| | Returns |
  • A hs._asm.axuielement object for the cell, or nil if the cell cannot be found.
|

| Signature | cp.ui.Grid:findColumnIndex(id) -> number | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Finds the Column Index based on an AXIdentifier ID. | | Parameters |

  • id - The AXIdentifier of the column index you want to find.
| | Returns |
  • A column index as a number, or nil if no index can be found.
|

Signature cp.ui.Grid:findRow(matcherFn) -> cp.ui.Row or nil
Type Method
Description Returns a Row that has a result of true when passed to the matcherFn predicate,
Parameters
  • matcherFn - The function to check the Row with.
Returns
  • The matching Row or nil.
Signature cp.ui.Grid:row(index) -> cp.ui.Row or nil
Type Method
Description Provides the Row at the specified index, or nil if it's not available.
Signature cp.ui.Grid:rows() -> table of cp.ui.Row or nil
Type Method
Description Provides a table with the list of cp.ui.Row elements for the rows.
Returns
  • A table containing the list of Rows, or nil if not presently available.
Signature cp.ui.Grid:rowsUI() -> table of axuielement
Type Method
Description Provides a table containing the axuielements which are rows in the outline.
Signature cp.ui.Grid:selectRow(path) -> cp.ui.Row
Type Method
Description Selects the row at the sub-level named in the path table.
Parameters
  • path - A table of names to navigate through to find the Row to select.
Returns
  • The selected Row, or nil if not found.
Signature cp.ui.Grid:visitRow(path, actionFn) -> cp.ui.Row
Type Method
Description Visits the row at the sub-level named in the names table, and executes the actionFn.
Parameters
  • names - The array of names to navigate down
  • actionFn - A function to execute when the target row is found.
Returns
  • The row that was visited, or nil if not.