Squirrel/Client/Events/GUI/onClientClickCheckbox
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|onClientClickCheckbox}} {{ScriptingChangesIn0.1.0.9}} This event is called when the local player clicks a checkbox. == Syntax == <code>function onClientClickCh…') |
(Added examples) |
||
Line 19: | Line 19: | ||
== Example == | == Example == | ||
− | + | This code will tell a player they pressed a checkbox. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onClientClickCheckbox( checkID, down ) | |
+ | { | ||
+ | Message("You just clicked on a checkbox."); | ||
+ | return 1; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | This code will stop a player from enabling (or disabling) a checkbox. | ||
+ | |||
+ | <code lang="squirrel"> | ||
+ | function onClientClickCheckbox( checkID, down ) | ||
+ | { | ||
+ | Message("I'm afraid I can't let you do that."); | ||
+ | return 0; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The function [[Squirrel/Client/Functions/Messages/Message|Message]] was used in both examples and has more information on the corresponding page. | |
== Related Events == | == Related Events == | ||
{{Squirrel/Client/Events/GUI}} | {{Squirrel/Client/Events/GUI}} |
Latest revision as of 02:50, 2 August 2011
This event is called when the local player clicks a checkbox.
[edit] Syntax
function onClientClickCheckbox( int checkID, bool down )
[edit] Arguments
- checkID - The ID of the checkbox in question
- down - Was the mouse button pressed down or released
[edit] Returns
- 1 - Let the checkbox be checked/unchecked normally
- 0 - Returning 0 locks the status of the checkbox (if the mouse button is released)
[edit] Example
This code will tell a player they pressed a checkbox.
function onClientClickCheckbox( checkID, down ) { Message("You just clicked on a checkbox."); return 1; }
This code will stop a player from enabling (or disabling) a checkbox.
function onClientClickCheckbox( checkID, down ) { Message("I'm afraid I can't let you do that."); return 0; }
[edit] Notes
The function Message was used in both examples and has more information on the corresponding page.
[edit] Related Events
- onClientClickButton
- onClientClickCheckbox