#cp.ui.StaticText

Static Text Module.


#API Overview

Functions - API calls offered directly by the extension

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

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


#API Documentation

#Functions

Signaturecp.ui.StaticText.matches(element) -> boolean
TypeFunction
DescriptionChecks if the element is a Static Text element.
Parameters
  • element - The axuielement to check.
Returns
  • If true, the element is a Static Text element.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 17

#Fields

Signaturecp.ui.StaticText.value <cp.prop: anything>
TypeField
DescriptionThe current value of the text field.
NotesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 67

#Methods

Signaturecp.ui.StaticText:clear() -> self
TypeMethod
DescriptionClears the value of a Static Text box.
Parameters
  • None
Returns
  • Self
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 122

Signaturecp.ui.StaticText:loadLayout(layout) -> none
TypeMethod
DescriptionLoads a Static Text layout.
Parameters
  • layout - A table containing the Static Text layout settings - created using cp.ui.StaticText:saveLayout().
Returns
  • None
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 155

Signaturecp.ui.StaticText:saveLayout() -> table
TypeMethod
DescriptionSaves the current Static Text layout to a table.
Parameters
  • None
Returns
  • A table containing the current Static Text Layout.
NotesNone
ExamplesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 140

Signaturecp.ui.StaticText(parent, uiFinder[, convertFn]) -> StaticText
TypeMethod
DescriptionCreates a new StaticText. They have a parent and a finder function.
Parameters
  • parent - The parent object.
  • uiFinder - The function will return the axuielement for the StaticText.
  • convertFn - (optional) If provided, will be passed the string value when returning.
Returns
  • The new StaticText.
Notes
  • Additionally, an optional convert function can be provided, with the following signature:
  • function(textValue) -> anything
  • The value will be passed to the function before being returned, if present. All values passed into value(x) will be converted to a string first via tostring.
  • For example, to have the value be converted into a number, simply use tonumber like this:
  • lua</li><li>local numberField = StaticText(parent, function() return ... end, tonumber)</li><li>
ExamplesNone
Sourcesrc/extensions/cp/ui/StaticText.lua line 30