Class TextField

An editable text field.

Usage:

     -- Create a text field that prints whatever is in it when enter is pressed.
     local textfield = TextField(0, 0, 100, 16, "default text")
     textfield.onEnter = function(textfield)
       print(textfield.text)
     end

Fields

TextField.backgroundColor The background color of this text field.
TextField.borderColor The color of this text field's border.
TextField.cursorColor The color of the text cursor.
TextField.cursorRate The period of the cursor's blinking.
TextField.defaultTextColor The color of this text field's default text.
TextField.defaultTextHoverColor The color of this text field's default text when the mouse is over it.
TextField.filter The filter pattern to restrict this TextField's text to, or nil if none.
TextField.repeatDelay Delay before a key starts repeating.
TextField.repeatInterval Interval between key repeats.
TextField.textColor The color of this text field's text.
TextField.textHoverColor The color of this text field's text when the mouse is over it.

Constructor

TextField:_init (x, y, width, height, defaultText) Constructs a new TextField.

Methods

TextField:onEnter () Called when the user presses enter in this text field.
TextField:setCursorPosition (pos) Set the character position of the text cursor.


Fields

TextField.backgroundColor
The background color of this text field.
TextField.borderColor
The color of this text field's border.
TextField.cursorColor
The color of the text cursor.
TextField.cursorRate
The period of the cursor's blinking.
TextField.defaultTextColor
The color of this text field's default text.
TextField.defaultTextHoverColor
The color of this text field's default text when the mouse is over it.
TextField.filter
The filter pattern to restrict this TextField's text to, or nil if none.
TextField.repeatDelay
Delay before a key starts repeating.
TextField.repeatInterval
Interval between key repeats.
TextField.textColor
The color of this text field's text.
TextField.textHoverColor
The color of this text field's text when the mouse is over it.

Constructor

TextField:_init (x, y, width, height, defaultText)
Constructs a new TextField.

Parameters:

  • x The x coordinate of the new component, relative to its parent.
  • y The y coordinate of the new component, relative to its parent.
  • width The width of the new component.
  • height The height of the new component.
  • defaultText The text to display when nothing has been entered.

Methods

TextField:onEnter ()
Called when the user presses enter in this text field.
TextField:setCursorPosition (pos)
Set the character position of the text cursor.

Parameters:

  • pos The new position for the cursor, where 0 is the beginning of the field.
generated by LDoc 1.4.3 Last updated 2015-02-10 07:20:59