guiCreateEdit | Multi Theft Auto: Wiki Skip to content

guiCreateEdit

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function is for creating a new GUI edit box. This is a text box in which the user can input text. Edit boxes only allow a single line of text. If you want to allow multiple lines of text create a memo box using guiCreateMemo.

Syntax

guiCreateEdit ( )

Code Examples

client

This example creates an edit box alongside an "Output!" button. When the button is clicked, it will output the message in the edit box into the Chat Box.

--create our button
button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "OK", true )
--Create an edit box and define it as "editBox".
editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "", true )
guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this
--setup our function to output the message to the chatbox
function outputEditBox ()
local text = guiGetText ( editBox )--get the text from the edit box
outputChatBox ( text ) --output that text
end
addEventHandler ( "onClientGUIClick", button, outputEditBox )

See Also

GUI Functions