Skip to content

Textfield

GNamimates edited this page Oct 30, 2024 · 3 revisions

Class Name: GNUI.TextField

an element that allows the user to type in text.

Note

This element is very WIP. Expect alot of changes

Quick example on making a text field and typing something with it.

local GNUI = require"GNUI.main"
local TextField = require"GNUI.element.textField"
local screen = GNUI.getScreenCanvas()

local textField = TextField.new(screen)
textField.FIELD_CONFIRMED:register(function (field)
  print("text confirmed: " .. field.textField)
end)

Properties

Type Field Description
string editingTextField ...
boolean isEditing ...
boolean isVertical ...
integer pipePos ...
string textField ...

Events

Event Description
FIELD_CHANGED ...
FIELD_CONFIRMED ...

Methods

Returns Methods
GNUI.TextField TextField.new(parent : GNUI.Box?, variant : string|"none"|"default"?)
self TextField:updateField()
self TextField:setTextField(text : string)
self TextField:appendTextField()
self TextField:setEditing()
TextField:setToggle()

TextField.new(parent, variant)

Arguments

  • GNUI.Box? parent

  • string|"none"|"default"? variant

Returns GNUI.TextField

TextField:updateField(self)

Updates the text being displayed in the text field. call this when modifying the fields without using the official APIs.

Arguments

Returns self

TextField:setTextField(text)

Sets the exact value of the text field.

Arguments

  • string text

Returns self

TextField:appendTextField()

Appends a string onto the existing editing text field.

Arguments

Returns self

TextField:setEditing()

Sets the sate if the text field is being edited or not. setting this to false from true will confirm the text field

Arguments

Returns self

TextField:setToggle()

Clone this wiki locally