DXX: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Tails moved page Test123 to DXX)
 
(4 intermediate revisions by the same user not shown)
Line 11: Line 11:
*'''eventName:''' The name of the event you want to listen for. Possible values are:
*'''eventName:''' The name of the event you want to listen for. Possible values are:
**'''click'''
**'''click'''
**'''close'''
**'''change'''
**'''destroy'''
**'''destroy'''
**'''change'''
*'''callbackFunction:''' The function that is called when this event occurs.
*'''callbackFunction:''' The function that is called when this event is triggered.
**'''''responseData''''' - A string containing the remote response or "ERROR" if there was a problem
**'''''responseData''''' - A string containing the remote response or "ERROR" if there was a problem
**'''''errno''''' - A number containing the error number or zero if there was no error.
**'''''errno''''' - A number containing the error number or zero if there was no error.
Line 21: Line 22:
This function does not return anything
This function does not return anything


 
==Example==
<section name="Example" class="generic" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local win = Window(700, 400, 1000, 600, "cool window")
local win = Window(700, 400, 1000, 600, "cool window")
Line 30: Line 30:
btn.on("click", function() btn.value = "clicked" end)
btn.on("click", function() btn.value = "clicked" end)
</syntaxhighlight>
</syntaxhighlight>
</section>

Latest revision as of 15:05, 4 June 2018


OOP Syntax Help! I don't understand this!

Note: Use a dot instead of a colon to access class methods
Method: Dxx.on(...)


Syntax

bool Dxx.on(string eventName, function callbackFunction)

Required Arguments

  • eventName: The name of the event you want to listen for. Possible values are:
    • click
    • close
    • change
    • destroy
  • callbackFunction: The function that is called when this event occurs.
    • responseData - A string containing the remote response or "ERROR" if there was a problem
    • errno - A number containing the error number or zero if there was no error.
  • arguments... - The arguments that were passed into fetchRemote

Returns

This function does not return anything

Example

local win = Window(700, 400, 1000, 600, "cool window")
local btn = Button(55, 55, 125, 30, "click me")

btn.setParent(win)
btn.on("click", function() btn.value = "clicked" end)