Difference between revisions of "UI.TextField"

From GiderosMobile
Line 32: Line 32:
 
local screen=UI.Screen.new() -- needed to add the TextField
 
local screen=UI.Screen.new() -- needed to add the TextField
 
screen:ui(gui)
 
screen:ui(gui)
 +
</syntaxhighlight>
 +
 +
'''Selectable TextField'''
 +
<syntaxhighlight lang="lua">
 +
UI.Style:setDefault(UI.Theme.PointCore_Pink)
 +
 +
local tf=UI.TextField.new("",{ flags=FontBase.TLF_TOP|FontBase.TLF_REF_TOP, multiline=true})
 +
tf:setDimensions(200,500)
 +
tf:setPosition(50,50)
 +
tf:setText(
 +
"You can select a \e[color=#F00]part\e[color] of this text.\nIt should even be possible\nwith multiline texts.\n\n"..
 +
"Right mouse button to copy text."
 +
)
 +
tf:setFlags({ readonly=true, selectable=true })
 +
 +
local screen=UI.Screen.new()
 +
screen:ui(tf)
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 17:43, 30 October 2023

Available since: Gideros 2023.1
Class: UI

Description

Creates TextField widgets. The widget can be a TextField, a ButtonTextFieldCombo, a ButtonTextField or a PasswordField.

UI.TextField.new(text,layout,minwidth,minheight,pass,textType)
UI.ButtonTextFieldCombo.new(text,layout,minwidth,minheight,pass,textType)
UI.ButtonTextField.new(text,layout,minwidth,minheight,pass,textType)
UI.PasswordField.new(text,layout,minwidth,minheight,pass,textType)

Parameters

text: (bool) the TextField widget text
layout: (string) the TextField widget layout
minwidth: (number) the TextField widget minimum width
minheight: (number) the TextField widget minimum height
pass: (string) the TextField widget hiding symbol
textType: (number) the TextField widget text type, see Application Constants

Examples

TextField

local gui = UI.TextField.new("hello Gideros UI", nil, 64, 64, nil, Application.TEXTINPUT_CLASS_TEXT)
gui:setDimensions(256, 96)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)

gui:setTipText("some tip text")

local screen=UI.Screen.new() -- needed to add the TextField
screen:ui(gui)

Selectable TextField

UI.Style:setDefault(UI.Theme.PointCore_Pink)

local tf=UI.TextField.new("",{ flags=FontBase.TLF_TOP|FontBase.TLF_REF_TOP, multiline=true})
tf:setDimensions(200,500)
tf:setPosition(50,50)
tf:setText(
"You can select a \e[color=#F00]part\e[color] of this text.\nIt should even be possible\nwith multiline texts.\n\n"..
"Right mouse button to copy text."
)
tf:setFlags({ readonly=true, selectable=true })

local screen=UI.Screen.new()
screen:ui(tf)

ButtonTextFieldCombo

local gui = UI.ButtonTextFieldCombo.new("hello Gideros X", nil, 64, 64, nil, Application.TEXTINPUT_CLASS_TEXT)
gui:setDimensions(256, 96)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)

local screen=UI.Screen.new() -- needed to add the TextField
screen:ui(gui)

ButtonTextField

local gui = UI.ButtonTextField.new("hello Gideros X", nil, 64, 64, nil, Application.TEXTINPUT_CLASS_TEXT)
gui:setDimensions(256, 96)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)

local screen=UI.Screen.new() -- needed to add the TextField
screen:ui(gui)

PasswordField

local gui = UI.PasswordField.new("password", nil, 64, 64, nil, Application.TEXTINPUT_CLASS_TEXT)
gui:setDimensions(256, 96)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)

gui:setTipText("enter password")

local screen=UI.Screen.new() -- needed to add the TextField
screen:ui(gui)