Skip to content

TextField

Anthony Ma edited this page May 26, 2015 · 6 revisions

A component that allows for text input. #Fields

  • x default: 1 - x value of the component
  • y default: 1 - y value of the component
  • h default: 1 - height of the component
  • w default: 16 - width of the component
  • z default: 0 - z value of the component
  • parent - parent window object of the component
  • removed - whether the component has been queued for removal - should only be modified by the library itself
  • visible default: true - whether the component is visible
  • bgColor default: colors.white - the background color
  • textColor default: colors.black - the color of the text
  • placeholderColor default: colors.lightGray - the color of the placeholder text
  • placeholder default: "txUI TextField" - text displayed in when the field is empty
  • text default: "" - text displayed by the label
  • textAlign default: "center" - alignment of the label text
  • textMask default: "" - text mask for password input
  • active default: false - whether this is the active component - should only be modified by the library
  • cursorPos default: 0 - position of the cursor in the textfield
  • displayOffset default: 0 - offset of the text in the textfield - should only be modified by the library

#Functions

  • function draw(self) - draws the field - should only be called by the library itself
  • function click(self, x, y) - called by the library on a click event to check if the field has been clicked
  • function action(self) - called by the library on a click event by function click(self, x, y)
  • function key(self, keyCode) - called by the library on a key event
  • function char(self, char) - called by the library on a char event
  • function update(self) - called every update cycle and should not be modified
  • function termX(self) - returns the x position on the terminal
  • function termY(self) - returns the y position on the terminal
  • function setPos(self, x, y) - sets the position of the component
  • function setSize(self, w, h) - sets the size of the component