Skip to content
Anthony Ma edited this page May 26, 2015 · 5 revisions

A list stores buttons and labels and allows you to scroll through them. A list should only hold buttons and labels and may not work correctly with other components. #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
  • bgColorStripe default: colors.lightGray - the background color of the striped elements
  • textColor default: colors.black - the color of the text
  • textColorStripe default: colors.gray - the color of the text in the striped elements
  • activeColor default: colors.gray - the color if the element active - only applies if the element is a button
  • activeTextColor default: colors.white - the color of the text if the element active - only applies if the element is a button
  • textAlign default: "center" - alignment of the text
  • scrollBarColor default: colors.gray - color of the scroll bar
  • scrollBarTextColor default: colors.white - color of the arrows on the scroll bar
  • scrollBar default: true - whether the scroll bar is displayed
  • displayOffset default: 0 - offset for displaying the elements in the list - should only be modified by the library itself
  • components - table of all components - should only be modified by the library itself

#Functions

  • function draw(self) - draws the label - should only be called by the library itself
  • function click(self, x, y) - called by the library on a click event to pass the event along to the elements of the list
  • function scroll(self, direction) - called by the library on a scroll event to scroll through the list if the list is the active component
  • function addComponent(self, componentTbl) - adds a component to the list - must be a label or button
  • function update(self) - called every update cycle
  • 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