OnClientGUIChanged: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Undo revision 67059 by Pirulax (talk))
Tag: Undo
 
(8 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Client function}}
{{Client event}}
__NOTOC__  
__NOTOC__  
This event is fired when a memo or an editbox has changed (either by the user or by [[guiSetText]]).
This event is fired when a [[Element/GUI/Memo|memo]] or an [[Element/GUI/Edit_field|editbox]] has changed (either by the user or by [[guiSetText]]).


==Parameters==  
==Parameters==  
Line 7: Line 7:
element theElement
element theElement
</syntaxhighlight>  
</syntaxhighlight>  
* '''theElement''': The element which was changed.
* '''theElement''': The GUI [[element]] which was changed.
 
==Source==
The [[event system#Event source|source]] of this event is the element which was changed.
 
==Example==  
==Example==  
This example creates an editbox and prints a message when it has changed
This example creates an editbox and prints a message when it has changed
Line 13: Line 17:
editBox = guiCreateEdit(0.3,0.1,0.4,0.1,"",true)
editBox = guiCreateEdit(0.3,0.1,0.4,0.1,"",true)
addEventHandler("onClientGUIChanged", editBox, function(element)  
addEventHandler("onClientGUIChanged", editBox, function(element)  
   outputChatBox("The box now reads: " .. getGuiText(element))
   outputChatBox("The box now reads: " .. guiGetText(element))
end)
end)
</syntaxhighlight>
</syntaxhighlight>
Or
<syntaxhighlight lang="lua">
editBox = guiCreateEdit(0.3,0.1,0.4,0.1,"",true)
addEventHandler("onClientGUIChanged", editBox, function()
  outputChatBox("The box now reads: " .. guiGetText(source))
end)
</syntaxhighlight>
[[pl:onClientGUIChanged]]


==See Also==
==See Also==
===GUI events===
{{GUI_events}}
{{GUI_events}}
===Client event functions===
===Client event functions===
{{Client_event_functions}}
{{Client_event_functions}}

Latest revision as of 21:40, 20 July 2020

This event is fired when a memo or an editbox has changed (either by the user or by guiSetText).

Parameters

element theElement
  • theElement: The GUI element which was changed.

Source

The source of this event is the element which was changed.

Example

This example creates an editbox and prints a message when it has changed

editBox = guiCreateEdit(0.3,0.1,0.4,0.1,"",true)
addEventHandler("onClientGUIChanged", editBox, function(element) 
   outputChatBox("The box now reads: " .. guiGetText(element))
end)

Or

editBox = guiCreateEdit(0.3,0.1,0.4,0.1,"",true)
addEventHandler("onClientGUIChanged", editBox, function() 
   outputChatBox("The box now reads: " .. guiGetText(source))
end)

See Also

Input

GUI


Client event functions