cp.ui.GridElement

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


Submodules


API Overview

Functions - API calls offered directly by the extension

  • matches
  • withColumnsOf
  • withHeaderOf
  • withRowsOf

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

  • GridElement

Fields - Variables which can only be accessed from an object returned by a constructor

  • columns
  • columnsUI
  • firstRow
  • header
  • headerUI
  • lastRow
  • rowsUI
  • selectedColumns
  • selectedColumnsUI
  • selectedRows
  • selectedRowsUI
  • visibleColumns
  • visibleColumnsUI
  • visibleRows
  • visibleRowsUI

Methods - API calls which can only be made on an object returned by a constructor

  • doSelectRow
  • fetchColumn
  • findCell
  • findColumnIndex
  • row
  • selectRow
  • selectRowAt
  • selectRows
  • visitRow

API Documentation

Functions

matches

   
Signature cp.ui.GridElement.matches(element) -> boolean
Type Function
Description Checks if the element is an GridElement.
Parameters
  • element - An element to check
Returns
  • A boolean
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 96

withColumnsOf

   
Signature cp.ui.GridElement:withColumnsOf(columnInit) -> cp.ui.GridElement.Builder
Type Function
Description Returns a new Builder for GridElements with the specified columnInit.
Parameters
  • columnInit - A Column initializer.
Returns
  • A new Builder for GridElements.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 86

withHeaderOf

   
Signature cp.ui.GridElement:withHeaderOf(headerInit) -> cp.ui.GridElement.Builder
Type Function
Description Returns a new Builder for GridElements with the specified headerInit.
Parameters
  • headerInit - A Header initializer.
Returns
  • A new Builder for GridElements.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 66

withRowsOf

   
Signature cp.ui.GridElement:withRowsOf(...) -> function(parent, uiFinder) -> GridElement
Type Function
Description A combinator that returns a function expecting a parent and uiFinder and returns a GridElement instance, with the arguments defining the Cell instances that make up the rows of the table.
Parameters
  • ... - One or more arguments to pass to the constructor.
Returns
  • A function that will return a new GridElement instance.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 115

Constructors

GridElement

   
Signature cp.ui.GridElement(parent, uiFinder, headerInit, rowInit, columnInit) -> cp.ui.GridElement
Type Constructor
Description Creates a new GridElement instance.
Parameters
  • parent - The parent Element instance.
  • uiFinder - A hs.uielement or axuielementObject that will be used to find this element.
  • headerInit - An initializer function that will be called to create the header Element instance.
  • rowInit - An initializer function that will be called to create each row element.
  • columnInit - An initializer function that will be called to create each column element.
Returns
  • A new GridElement instance.
Notes
  • The headerType, rowType arguments are optional.
Examples None
Source src/extensions/cp/ui/GridElement.lua line 131

Fields

columns

   
Signature cp.ui.GridElement.columns <table of cp.ui.Column; live?; read-only>
Type Field
Description The list of Columns which are children of this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 260

columnsUI

   
Signature cp.ui.GridElement.columnsUI <cp.prop: table of axuielement; live?; read-only>
Type Field
Description The list of axuielements which are children of this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 253

firstRow

   
Signature cp.ui.GridElement.firstRow <cp.ui.Element>
Type Field
Description An Element of the rowInit type that will always point at the first row (if available).
Notes None
Source src/extensions/cp/ui/GridElement.lua line 181

   
Signature cp.ui.GridElement.header <cp.ui.Element>
Type Field
Description The Element representing the AXHeader of the GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 167

headerUI

   
Signature cp.ui.GridElement.headerUI <cp.prop: axuielement; read-only; live>
Type Field
Description Returns the header UI element.
Parameters
  • None
Returns
  • The header UI element.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 154

lastRow

   
Signature cp.ui.GridElement.lastRow <cp.ui.Element>
Type Field
Description An Element of the rowInit type that will always point at the last row (if available).
Notes None
Source src/extensions/cp/ui/GridElement.lua line 193

rowsUI

   
Signature cp.ui.GridElement.rowsUI <cp.prop: table of axuielement; live?; read-only>
Type Field
Description The list of Rows which are children of this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 174

selectedColumns

   
Signature cp.ui.GridElement.selectedColumns <table of cp.ui.Column; live?; read-only>
Type Field
Description The list of Columns which are selected in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 274

selectedColumnsUI

   
Signature cp.ui.GridElement.selectedColumnsUI <cp.prop: table of axuielement; live?>
Type Field
Description The list of axuielement AXColumns which are selected in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 267

selectedRows

   
Signature cp.ui.GridElement.selectedRows <table of cp.ui.Row; live?; read-only>
Type Field
Description The list of Rows which are selected in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 232

selectedRowsUI

   
Signature cp.ui.GridElement.selectedRowsUI <cp.prop: table of cp.ui.Row; live?>
Type Field
Description The list of Rows which are selected in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 223

visibleColumns

   
Signature cp.ui.GridElement.visibleColumns <table of cp.ui.Column; live?; read-only>
Type Field
Description The list of Columns which are visible in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 288

visibleColumnsUI

   
Signature cp.ui.GridElement.visibleColumnsUI <cp.prop: table of axuielement; live?; read-only>
Type Field
Description The list of Columns which are visible in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 281

visibleRows

   
Signature cp.ui.GridElement.visibleRows <table of cp.ui.Row; live?; read-only>
Type Field
Description The list of Rows which are visible in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 246

visibleRowsUI

   
Signature cp.ui.GridElement.visibleRowsUI <cp.prop: table of cp.ui.Row; live?; read-only>
Type Field
Description The list of Rows which are visible in this GridElement.
Notes None
Source src/extensions/cp/ui/GridElement.lua line 239

Methods

doSelectRow

   
Signature cp.ui.GridElement: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.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 452

fetchColumn

   
Signature cp.ui.GridElement:fetchColumn(columnsUI) -> table of cp.ui.Columns
Type Method
Description Returns a table of the same length as columnsUI. If provided items in the table are not valid columns in this table, then nil will be put in the matching index. Note that this will break the standard #/looping behaviour for tables at that point.
Parameters
  • columnsUI - The list of AXColumn axuielements to find.
Returns
  • A table with the same number of elements, containing the matching Column instances.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 308

findCell

   
Signature cp.ui.GridElement:findCell(rowNumber, columnId) -> hs.axuielement | nil
Type Method
Description Finds a specific Cell.
Parameters
  • rowNumber - The row number.
  • columnId - The Column ID.
Returns
  • A hs.axuielement object for the cell, or nil if the cell cannot be found.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 376

findColumnIndex

   
Signature cp.ui.GridElement: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.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 355

row

   
Signature cp.ui.GridElement:row(index) -> cp.ui.Element | nil
Type Method
Description Returns an Element at the specified index.
Parameters
  • index - The index of the Element to return.
Returns
  • The Element at the specified index.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 205

selectRow

   
Signature cp.ui.GridElement:selectRow(row) -> nil
Type Method
Description Attempts to select the provided cp.ui.Row.
Parameters
  • row - The cp.ui.Row to select.
Returns
  • nil
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 421

selectRowAt

   
Signature cp.ui.GridElement:selectRowAt(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.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 439

selectRows

   
Signature cp.ui.GridElement:selectRows(rows) -> nil
Type Method
Description Attempts to select the provided list of cp.ui.Rows.
Parameters
  • rows - The list of cp.ui.Rows to select.
Returns
  • nil
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 395

visitRow

   
Signature cp.ui.GridElement: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.
Notes None
Examples None
Source src/extensions/cp/ui/GridElement.lua line 341