Doc - gui - TextBox
Class: TextBox
TextBox draws text to the window
Constructor
pos.gui.TextBox(x: number, y: number, background: number|nil, foreground: number|nil, text: string, w: number|nil)
Creates a new TextBox at the given location.
If background
or foreground
is nil
, they are set as the defaults: colors.black
and colors.white
respectively.
if w
is nil
, it is set the the length of text
Variables
Type |
Name |
Description |
number |
bg |
Background color |
number |
fg |
Foreground color (text color) |
number |
w |
Max line length |
number |
h |
Number of lines |
string |
type |
Override. type is 'TextBox' |
Private Variables
Type |
Name |
Description |
string |
_text |
Text of the element |
table |
_lines |
Text split into lines by length and newline, used for drawing |
Instance Functions
Return |
Name |
Description |
nil |
draw(window: Window) |
Override. Draws the text |
nil |
setText(text: string) |
Sets the text and splits into lines |
string |
getText() |
Gets the current text |