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

Latest commit

 

History

History
283 lines (244 loc) · 25 KB

cp.ui.Table.md

File metadata and controls

283 lines (244 loc) · 25 KB

docs » cp.ui.Table


Represents an AXTable in the Apple Accessibility UX API.

API Overview

API Documentation

Functions

Signature cp.ui.Table.cellTextValue(cell) -> boolean
Type Function
Description Returns the cell's text value.
Parameters
  • cell - The cell to check
Returns
  • The combined text value of the cell.
Signature cp.ui.Table.cellTextValueIs(cell, value) -> boolean
Type Function
Description Checks if the cell's text value equals value.
Parameters
  • cell - The cell to check
  • value - The text value to compare.
Returns
  • true if the cell text value equals the provided value.
Signature cp.ui.Table.discloseRow(row) -> boolean
Type Function
Description Discloses the row, if possible.
Parameters
  • row - The row to disclose
Returns
  • true if the row is disclosable and is now expanded.
Signature cp.ui.Table.findRow(rows, names) -> axuielement
Type Function
Description Finds the row at the sub-level named in the names table and returns it.
Parameters
  • rows - The array of rows to process.
  • names - The array of names to navigate down
Returns
  • The row that was visited, or nil if not.
Signature cp.ui.Table.is(thing) -> boolean
Type Function
Description Checks if the thing is a Table.
Parameters
  • thing - The thing to check
Returns
  • true if the thing is a Table instance.
Signature cp.ui.Table.matches(element)
Type Function
Description Checks if the element is a valid table.
Parameters
  • element - The element to check.
Returns
  • true if it matches.
Signature cp.ui.Table.matchesContent(element) -> boolean
Type Function
Description Checks if the element is a valid table content element.
Parameters
  • element - The element to check
Returns
  • true if the element is a valid content element.
Signature cp.ui.Table.visitRow(rows, names) -> axuielement
Type Function
Description Selects the row at the sub-level named in the names table.
Parameters
  • rows - The array of rows to process.
  • names - The array of names to navigate down
Returns
  • The row that was visited, or nil if not.

Constructors

Signature cp.ui.Table(parent, uiFinder) -> self
Type Constructor
Description Creates a new Table.
Parameters
  • parent - The parent object.
  • uiFinder - A function or cp.prop which will return the axuielement that this table represents.
Returns
  • A new Table instance.

Fields

Signature cp.ui.Table.contentUI <cp.prop: hs._asm.axuielement; read-only>
Type Field
Description Returns the axuielement that contains the actual rows.
Signature cp.ui.Table.horizontalScrollBarUI <cp.prop: hs._asm.axuielement; read-only>
Type Field
Description The horizontal scroll bar UI element, if present.
Signature cp.ui.Table.isFocused <cp.prop: boolean; read-only>
Type Field
Description Returns true if the table is focused by the user.
Signature cp.ui.Table.verticalScrollBarUI <cp.prop: hs._asm.axuielement; read-only>
Type Field
Description The vertical scroll bar UI element, if present.

Methods

| Signature | cp.ui.Table:columnsUI() -> table of axuielements | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Return a list of column headers, if present. | | Parameters |

  • None
| | Returns |
  • Table of column headers. If the table is visible but no column headers are defined, an empty table is returned. If it's not visible, nil is returned.
|

Signature cp.ui.Table:deselectAll(rowUI) -> boolean
Type Method
Description Deselects the specified rows. If rowsUI is nil, then all rows will be deselected.
Parameters
  • rowUI - A table of hs._asm.axuielement objects for the rows you want to deselect.
Signature cp.ui.Table:deselectRow(rowUI) -> boolean
Type Method
Description Deselect a specific row.
Parameters
  • rowUI - The hs._asm.axuielement object of the row you want to deselect.
Signature cp.ui.Table:deselectRowAt(index) -> boolean
Type Method
Description Deselects a row at a specific index.
Parameters
  • index - The index of the row you wish to deselect.

| Signature | cp.ui.Table:findCellUI(rowNumber, columnId) -> hs._asm.axuielement | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Finds a specific Cell UI. | | 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.Table: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.Table:loadLayout(layout) -> none
Type Method
Description Loads a Table layout.
Parameters
  • layout - A table containing the Table layout settings - created using cp.ui.Table:saveLayout().
Returns
  • None

| Signature | cp.ui.Table:rowsUI([filterFn]) -> table of axuielements | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Returns the list of rows in the table. An optional filter function may be provided. | | Parameters |

  • filterFn - An optional function that will be called to check if individual rows should be included. If not provided, all rows are returned.
| | Returns |
  • Table of rows. If the table is visible but no rows match, it will be an empty table, otherwise it will be nil.
|

Signature cp.ui.Table:saveLayout() -> table
Type Method
Description Saves the current Table layout to a table.
Parameters
  • None
Returns
  • A table containing the current Table Layout.
Signature cp.ui.Table:selectAll(rowUI) -> boolean
Type Method
Description Selects the specified rows. If rowsUI is nil, then all rows will be selected.
Parameters
  • rowUI - A table of hs._asm.axuielement objects for the rows you want to select.

| Signature | cp.ui.Table:selectedRowsUI() -> table of axuielements | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Return a table of selected row UIs. | | Parameters |

  • None
| | Returns |
  • Table of hs._asm.axuielement objects, or nil if none could be found.
|

Signature cp.ui.Table:selectRow(rowUI) -> boolean
Type Method
Description Select a specific row.
Parameters
  • rowUI - The hs._asm.axuielement object of the row you want to select.
Signature cp.ui.Table:selectRowAt(index) -> boolean
Type Method
Description Select a row at a specific index.
Parameters
  • index - The index of the row you wish to select.
Signature cp.ui.Table:showRow(rowUI) -> boolean
Type Method
Description Shows a specific row.
Parameters
  • rowUI - The hs._asm.axuielement object of the row you want to show.
Signature cp.ui.Table:showRowAt(index) -> boolean
Type Method
Description Shows a row at a specific index.
Parameters
  • index - The index of the row you wish to show.

| Signature | cp.ui.Table:toCSV() -> string | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Gets the contents of the table and formats it as a CSV string. | | Parameters |

  • None
| | Returns |
  • A string or nil if an error occurs.
|

| Signature | cp.ui.Table:topRowsUI(filterFn) -> table of axuielements | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Returns a list of top-level rows in the table. An optional filter function may be provided. | | Parameters |

  • filterFn - An optional function that will be called to check if individual rows should be included. If not provided, all rows are returned.
| | Returns |
  • Table of rows. If the table is visible but no rows match, it will be an empty table, otherwise it will be nil.
|

Signature cp.ui.Table:viewFrame() -> hs.geometry rect
Type Method
Description Returns the Table frame.
Parameters
  • None