<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Graetz</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Graetz"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Graetz"/>
	<updated>2026-04-03T21:30:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=OnClientGUIClick&amp;diff=21581</id>
		<title>OnClientGUIClick</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=OnClientGUIClick&amp;diff=21581"/>
		<updated>2009-09-24T08:18:38Z</updated>

		<summary type="html">&lt;p&gt;Graetz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client event}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{Needs Checking|''middle'' button does not trigger this event.--[[User:50pence|50pence]] 12:19, 19 May 2008 (CDT)}}&lt;br /&gt;
This event is fired when the user clicks a GUI element.&lt;br /&gt;
&lt;br /&gt;
==Parameters== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string button, string state, int absoluteX, int absoluteY&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*'''button:''' the name of the mouse button that the GUI element was clicked with, can be ''left'', ''right'', or ''middle''.&lt;br /&gt;
*'''state:''' the state of the mouse button, will be ''down'' if the mouse button was pushed, or ''up'' if it was released.  '''Please note currently only the ''up'' state is supported.'''&lt;br /&gt;
*'''absoluteX:''' the X position of the mouse cursor, in pixels, measured from the left side of the screen.&lt;br /&gt;
*'''absoluteY:''' the Y position of the mouse cursor, in pixels, measured from the top of the screen.&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
The [[event system#Event source|source]] of this event is the GUI element that was clicked.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates an edit box alongside an &amp;quot;Output!&amp;quot; button. When the button is clicked with the left mouse button, it will output the message in the edit box into the Chat Box.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- when client's resource start, create the gui&lt;br /&gt;
function initGUI( )&lt;br /&gt;
    --create our button&lt;br /&gt;
    btnOutput = guiCreateButton( 0.7, 0.1, 0.2, 0.1, &amp;quot;Output!&amp;quot;, true )&lt;br /&gt;
&lt;br /&gt;
    --Create an edit box and define it as &amp;quot;editBox&amp;quot;.&lt;br /&gt;
    editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, &amp;quot;Type your message here!&amp;quot;, true )&lt;br /&gt;
    guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, getResourceRootElement( getThisResource( ) ), initGUI )&lt;br /&gt;
&lt;br /&gt;
--setup our function to output the message to the chatbox&lt;br /&gt;
function outputEditBox (button)&lt;br /&gt;
    if button == &amp;quot;left&amp;quot; then&lt;br /&gt;
        local text = guiGetText ( editBox )--get the text from the edit box&lt;br /&gt;
        outputChatBox ( text ) --output that text&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
--and attach our button to the outputEditBox function&lt;br /&gt;
function onResStart( )&lt;br /&gt;
addEventHandler ( &amp;quot;onClientGUIClick&amp;quot;, btnOutput, outputEditBox, false )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, getRootElement(), onResStart )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
===GUI events===&lt;br /&gt;
{{GUI_events}}&lt;br /&gt;
===Client event functions===&lt;br /&gt;
{{Client_event_functions}}&lt;/div&gt;</summary>
		<author><name>Graetz</name></author>
	</entry>
</feed>