Lua Class - guiTextBox

Extends guiFrame

guiTextBox is a class that contains 12 properties, 0 methods and 2 events. This class extends guiFrame.

CODE SAMPLE
--The values set in this constructor are random and may not work correctly.
local guiTextBox = teverse.construct("guiTextBox", {
    active = true,
    backgroundAlpha = 1.0,
    backgroundColour = colour.rgb(255, 255, 255),
    clip = true,
    dropShadowAlpha = 1.0,
    dropShadowBlur = 1.0,
    dropShadowColour = colour.rgb(255, 255, 255),
    dropShadowOffset = vector2(10, 10),
    name = "",
    parent = guiBase,
    position = guiCoord(0.0, 10, 0.0, 10),
    rotation = 1.0,
    size = guiCoord(0.0, 10, 0.0, 10),
    strokeAlpha = 1.0,
    strokeColour = colour.rgb(255, 255, 255),
    strokeRadius = 1.0,
    strokeWidth = 1.0,
    text = "",
    textAlign = enums.align,
    textAlpha = 1.0,
    textColour = colour.rgb(255, 255, 255),
    textEditable = true,
    textFont = "",
    textMultiline = true,
    textShadowColour = colour.rgb(255, 255, 255),
    textShadowSize = 1.0,
    textSize = 1.0,
    textWrap = true,
    visible = true,
    zIndex = 1.0
})
Properties
string text

The text rendered

CODE SAMPLE
guiTextBox.text = ""
print(guiTextBox.text) --> ""
enums.align textAlign

Determines the rendered text is aligned

CODE SAMPLE
guiTextBox.textAlign = enums.align
print(guiTextBox.textAlign) --> enums.align
number textAlpha

0.0 makes the text fully transparent and invisible.

CODE SAMPLE
guiTextBox.textAlpha = 1.0
print(guiTextBox.textAlpha) --> 1.0
colour textColour

Colour of the text rendered

CODE SAMPLE
guiTextBox.textColour = colour.rgb(255, 255, 255)
print(guiTextBox.textColour) --> colour.rgb(255, 255, 255)
READONLY
string textDimensions

Gets the bounds of the text

CODE SAMPLE
print(guiTextBox.textDimensions) --> ""
boolean textEditable

When true, the user can input into this box

CODE SAMPLE
guiTextBox.textEditable = true
print(guiTextBox.textEditable) --> true
string textFont

Determines the rendered text's font

CODE SAMPLE
guiTextBox.textFont = ""
print(guiTextBox.textFont) --> ""
boolean textMultiline

When true, user can input newline characters.

CODE SAMPLE
guiTextBox.textMultiline = true
print(guiTextBox.textMultiline) --> true
colour textShadowColour

The text shadow colour, rendered as a blurred backing.

CODE SAMPLE
guiTextBox.textShadowColour = colour.rgb(255, 255, 255)
print(guiTextBox.textShadowColour) --> colour.rgb(255, 255, 255)
number textShadowSize

When 0, no shadow is rendered. Increasing this value will determine how much the shadow spreads.

CODE SAMPLE
guiTextBox.textShadowSize = 1.0
print(guiTextBox.textShadowSize) --> 1.0
number textSize

Size of the text rendered

CODE SAMPLE
guiTextBox.textSize = 1.0
print(guiTextBox.textSize) --> 1.0
boolean textWrap

When true, text wraps onto a new line with new line characters.

CODE SAMPLE
guiTextBox.textWrap = true
print(guiTextBox.textWrap) --> true
INHERITED READONLY
vector2 absolutePosition

Absolute position in pixels from the top left of the screen

CODE SAMPLE
print(guiTextBox.absolutePosition) --> vector2(10, 10)
INHERITED READONLY
vector2 absoluteSize

Absolute size in pixels

CODE SAMPLE
print(guiTextBox.absoluteSize) --> vector2(10, 10)
INHERITED
boolean active

When true, this element can capture the mouse's hover

CODE SAMPLE
guiTextBox.active = true
print(guiTextBox.active) --> true
INHERITED
number backgroundAlpha

An alpha value of 1.0 is completely visible, 0.0 is invisible.

CODE SAMPLE
guiTextBox.backgroundAlpha = 1.0
print(guiTextBox.backgroundAlpha) --> 1.0
INHERITED
colour backgroundColour

CODE SAMPLE
guiTextBox.backgroundColour = colour.rgb(255, 255, 255)
print(guiTextBox.backgroundColour) --> colour.rgb(255, 255, 255)
INHERITED READONLY
table children

CODE SAMPLE
print(guiTextBox.children) --> {}
INHERITED
boolean clip

When true, children are cropped to fit

CODE SAMPLE
guiTextBox.clip = true
print(guiTextBox.clip) --> true
INHERITED
number dropShadowAlpha

CODE SAMPLE
guiTextBox.dropShadowAlpha = 1.0
print(guiTextBox.dropShadowAlpha) --> 1.0
INHERITED
number dropShadowBlur

CODE SAMPLE
guiTextBox.dropShadowBlur = 1.0
print(guiTextBox.dropShadowBlur) --> 1.0
INHERITED
colour dropShadowColour

CODE SAMPLE
guiTextBox.dropShadowColour = colour.rgb(255, 255, 255)
print(guiTextBox.dropShadowColour) --> colour.rgb(255, 255, 255)
INHERITED
vector2 dropShadowOffset

CODE SAMPLE
guiTextBox.dropShadowOffset = vector2(10, 10)
print(guiTextBox.dropShadowOffset) --> vector2(10, 10)
INHERITED READONLY
number id

CODE SAMPLE
print(guiTextBox.id) --> 1.0
INHERITED
string name

CODE SAMPLE
guiTextBox.name = ""
print(guiTextBox.name) --> ""
INHERITED
guiBase parent

Parent of a guiBase must be another gui element

CODE SAMPLE
guiTextBox.parent = guiBase
print(guiTextBox.parent) --> guiBase
INHERITED
guiCoord position

Position relative to the parent element

CODE SAMPLE
guiTextBox.position = guiCoord(0.0, 10, 0.0, 10)
print(guiTextBox.position) --> guiCoord(0.0, 10, 0.0, 10)
INHERITED
number rotation

CODE SAMPLE
guiTextBox.rotation = 1.0
print(guiTextBox.rotation) --> 1.0
INHERITED
guiCoord size

Size relative to the parent element

CODE SAMPLE
guiTextBox.size = guiCoord(0.0, 10, 0.0, 10)
print(guiTextBox.size) --> guiCoord(0.0, 10, 0.0, 10)
INHERITED
number strokeAlpha

CODE SAMPLE
guiTextBox.strokeAlpha = 1.0
print(guiTextBox.strokeAlpha) --> 1.0
INHERITED
colour strokeColour

CODE SAMPLE
guiTextBox.strokeColour = colour.rgb(255, 255, 255)
print(guiTextBox.strokeColour) --> colour.rgb(255, 255, 255)
INHERITED
number strokeRadius

CODE SAMPLE
guiTextBox.strokeRadius = 1.0
print(guiTextBox.strokeRadius) --> 1.0
INHERITED
number strokeWidth

CODE SAMPLE
guiTextBox.strokeWidth = 1.0
print(guiTextBox.strokeWidth) --> 1.0
INHERITED
boolean visible

CODE SAMPLE
guiTextBox.visible = true
print(guiTextBox.visible) --> true
INHERITED
number zIndex

Increasing the zIndex will render this element above others. Currently a signed 16 bit integer.

CODE SAMPLE
guiTextBox.zIndex = 1.0
print(guiTextBox.zIndex) --> 1.0
Methods
INHERITED
guiBase child( string name )
CODE SAMPLE
guiTextBox:child("") --> guiBase

Returns nil if not found

INHERITED
destroy( )
CODE SAMPLE
guiTextBox:destroy() --> 

Destroys this object, further accessing this instance will error

INHERITED
destroyChildren( )
CODE SAMPLE
guiTextBox:destroyChildren() --> 

Destroys all children

Events
:on("keyDown", function( enums.keysym keyCode ) end)

Key pressed

CODE SAMPLE
guiTextBox:on("keyDown", function(keyCode)
  print(keyCode) --> enums.keysym
end)
:on("keyUp", function( enums.keysym keyCode ) end)

Key released

CODE SAMPLE
guiTextBox:on("keyUp", function(keyCode)
  print(keyCode) --> enums.keysym
end)
INHERITED
:on("changed", function( string property, variant oldValue, variant newValue ) end)

Fired when a property is changed.

guiTextBox:on("changed", function(property, oldValue, newValue)
  print(property) --> ""  print(oldValue) --> variant  print(newValue) --> variant
end)
INHERITED
:on("childAdded", function( guiBase newChild ) end)

Triggered when the viewport size is changed

guiTextBox:on("childAdded", function(newChild)
  print(newChild) --> guiBase
end)
INHERITED
:on("childRemoved", function( guiBase newChild ) end)

Triggered when a child is added

guiTextBox:on("childRemoved", function(newChild)
  print(newChild) --> guiBase
end)
INHERITED
:on("destroying", function( guiBase newChild ) end)

Triggered when the object is destroyed

guiTextBox:on("destroying", function(newChild)
  print(newChild) --> guiBase
end)
INHERITED
:on("fingerDown", function( vector2 fingerPosition ) end)

finger down

guiTextBox:on("fingerDown", function(fingerPosition)
  print(fingerPosition) --> vector2(10, 10)
end)
INHERITED
:on("fingerUp", function( vector2 fingerPosition ) end)

finger up

guiTextBox:on("fingerUp", function(fingerPosition)
  print(fingerPosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseEnter", function( ) end)

Mouse is hovering over this element

guiTextBox:on("mouseEnter", function()

end)
INHERITED
:on("mouseExit", function( ) end)

Mouse is no longer hovering

guiTextBox:on("mouseExit", function()

end)
INHERITED
:on("mouseLeftDown", function( vector2 mousePosition ) end)

Left mouse button down

guiTextBox:on("mouseLeftDown", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseLeftUp", function( vector2 mousePosition ) end)

Left mouse button up

guiTextBox:on("mouseLeftUp", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseMiddleDown", function( vector2 mousePosition ) end)

Middle mouse button down

guiTextBox:on("mouseMiddleDown", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseMiddleUp", function( vector2 mousePosition ) end)

Middle mouse button up

guiTextBox:on("mouseMiddleUp", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseRightDown", function( vector2 mousePosition ) end)

Right mouse button down

guiTextBox:on("mouseRightDown", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseRightUp", function( vector2 mousePosition ) end)

Right mouse button up

guiTextBox:on("mouseRightUp", function(mousePosition)
  print(mousePosition) --> vector2(10, 10)
end)
INHERITED
:on("mouseWheel", function( vector2 wheelMovement ) end)

Mouse wheeled

guiTextBox:on("mouseWheel", function(wheelMovement)
  print(wheelMovement) --> vector2(10, 10)
end)

Some sections of our docs are maintained on github.