ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. guiCreateEdit

Function

guiCreateEdit

Creates a single-line text field. Changing the text fires onClientGUIChanged, Enter fires onClientGUIAccepted.

Syntax

gui-edit guiCreateEdit(float x, float y, float width, float height, string text, bool relative [, element parent = nil])

Arguments

xfloat
X position.
yfloat
Y position.
widthfloat
Width.
heightfloat
Height.
textstring
Initial text.
relativebool
Relative values.Optional in MTA:SA: bool relative = false
parentelement, optional = nil
Parent.

Differences from MTA:SA

  • Arguments in a different colour differ from MTA:SA.

In MTA:SA

guiCreateEdit(float x, float y, float width, float height, string text, bool relative = false, gui-element parent = nil)

Returns

The field.

Example

local edit = guiCreateEdit(20, 20, 260, 30, "", false)
guiEditSetMaxLength(edit, 24)
addEventHandler("onClientGUIAccepted", edit, function()
    outputChatBox("Wpisano: " .. guiGetText(edit))
end, false)

See also