Internationalisation
Bundled Plugins API
TextField
​
Text Field Module.

API Overview

  • Functions - API calls offered directly by the extension
  • ​matches​
  • Fields - Variables which can only be accessed from an object returned by a constructor
  • ​value​
  • Methods - API calls which can only be made on an object returned by a constructor
  • ​clear​
  • ​doConfirm​
  • ​doFocus​
  • ​forceFocus​
  • ​getValue​
  • ​loadLayout​
  • ​saveLayout​
  • ​setValue​
  • ​TextField​

API Documentation

Functions

​matches​

Signature
cp.ui.TextField.matches(element[, subrole]) -> boolean
Type
Function
Description
Checks to see if an element matches what we think it should be.
Parameters
  • element - An axuielementObject to check.
  • subrole - (optional) If provided, the field must have the specified subrole.
Returns
  • true if matches otherwise false

Fields

​value​

Signature
cp.ui.TextField.value <cp.prop: string>
Type
Field
Description
The current value of the text field.

Methods

​clear​

Signature
cp.ui.TextField:clear() -> self
Type
Method
Description
Clears the value of a Text Field.
Parameters
  • None
Returns
  • Self

​doConfirm​

Signature
cp.ui.TextField:doConfirm() -> cp.rx.go.Statement
Type
Method
Description
A Statement that will confirm the current text value.

​doFocus​

Signature
cp.ui.TextField:doFocus() -> cp.rx.go.Statement
Type
Method
Description
A Statement that will attempt to focus on the current TextField.

​forceFocus​

Signature
cp.ui.TextField:forceFocus()
Type
Method
Description
Configures the TextField to force a focus on the field before editing.

​getValue​

Signature
cp.ui.TextField:getValue() -> string
Type
Method
Description
Gets the value of the Text Field.
Parameters
  • None
Returns
  • The value of the Text Field as a string.

​loadLayout​

Signature
cp.ui.TextField:loadLayout(layout) -> none
Type
Method
Description
Loads a Text Field layout.
Parameters
  • layout - A table containing the Text Field layout settings - created using cp.ui.TextField:saveLayout().
Returns
  • None

​saveLayout​

Signature
cp.ui.TextField:saveLayout() -> table
Type
Method
Description
Saves the current Text Field layout to a table.
Parameters
  • None
Returns
  • A table containing the current Text Field Layout.

​setValue​

Signature
cp.ui.TextField:setValue(value) -> self
Type
Method
Description
Sets the value of the Text Field.
Parameters
  • value - The value you want to set the Text Field to as a string.
Returns
  • Self

​TextField​

Signature
cp.ui.TextField(parent, uiFinder[, convertFn]) -> TextField
Type
Method
Description
Creates a new TextField. They have a parent and a finder function.
Parameters
  • parent - The parent object.
  • uiFinder - The function will return the axuielement for the TextField.
  • getConvertFn - (optional) If provided, will be passed the string value when returning.
  • setConvertFn - (optional) If provided, will be passed the number value when setting.
Returns
  • The new TextField.