#
cp.ui.ScrollArea
A ScrollArea
represents an AXScrollArea
. They primarily function as a "portal"
to view a larger area of the contained axuielement
within (accessed via the AXContents
attribute),
and also provide access to the vertical and horizontal scroll bars (accessed via the
verticalScrollBar
and horizontalScrollBar
properties).
The class that wraps the AXContents
attribute can be provided via the contentsInit
parameter in the
constructor. If not provided it defaults to Element.
The ScrollArea
also delegates to the contents
property, so you can access
any properties of the contained Element directly.
For example, if you have a ScrollArea
with a contents
of a TextField,
you can normally access the text value via the TextField.value property.
However, if you want to access the text value via the ScrollArea
itself, you can do so
via the ScrollArea.value
property, like so:
local scrollArea = ScrollArea(parent, ui, TextArea)
-- via `contents`:
local value = scrollArea.contents:value()
--- via delegation:
local value = scrollArea:value()
It also has a Builder that supports customising an Element
Builder
to create a ScrollArea
with a specified contents
Element
type. For example, another way to
define our ScrollArea
that contains a TextField
is:
local scrollAreaWithTextField = ScrollArea:containing(TextField)
local scrollArea = scrollAreaWithTextField(parent, ui)
The main advantage of this style is that you can pass the Builder
in to other Element
types
that require an "Element
init" that will only be provided a parent and UI finder.
This is a subclass of Element.
#
Submodules
#
API Overview
Functions - API calls offered directly by the extension
containing matches
Constructors - API calls which return an object, typically one that offers API methods
ScrollArea
Fields - Variables which can only be accessed from an object returned by a constructor
contents contentsUI horizontalScrollBar selectedChildrenUI verticalScrollBar viewFrame
Methods - API calls which can only be made on an object returned by a constructor
childrenUI deselectAll loadLayout saveLayout selectAll selectChild selectChildAt shiftHorizontalBy shiftHorizontalTo shiftVerticalBy shiftVerticalTo showChild showChildAt