RegisterEventHandler: Difference between revisions
Jump to navigation
Jump to search
(Created page with "==registerEventHandler== Registers an event handler function for a specific event. Lua Syntax: <pre>registerEventHandler(event, eventHandler)</pre> ===Arguments=== ====event==...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
Lua Syntax: | Lua Syntax: | ||
<pre>registerEventHandler(event, eventHandler)</pre> | <pre>registerEventHandler(event, eventHandler [, eventFlags])</pre> | ||
===Arguments=== | ===Arguments=== | ||
====event==== | ====event==== | ||
:'''"string"''' - The event which triggers the event handler to be called. Currently supported events: "mainLoop", "animationStarted", "animationStopped", "textStarted", "textStopped". | :'''"string"''' - The event which triggers the event handler to be called. Currently supported events: "mainLoop", "mouseEvent", "animationStarted", "animationStopped", "textStarted", "textStopped". | ||
====eventHandler==== | ====eventHandler==== | ||
:'''"string"''' - The name of the lua function which is called when the event occurs. The function | :'''"string"''' - The name of the lua function which is called when the event occurs. The function for the events "animationStarted", "animationStopped", "textStarted" and "textStopped" should take exactly one argument which is the affected visionaire object. | ||
:There are no arguments for the "mainLoop" event handler. | |||
:The function for the "mouseEvent" takes two arguments, the first one is the mouse event (see "eventFlags" parameter) and the second argument is the current mouse position (a table containing x- and y-position). | |||
====eventFlags==== | |||
:'''{int,...}''' - Can only be specified for event "mouseEvent": a list of mouse events where the event handler is called. | |||
:Currently the following mouse events are supported: eEvtMouseMove, eEvtMouseLeftButtonDoubleClick, eEvtMouseLeftButtonDown, eEvtMouseLeftButtonUp, eEvtMouseLeftButtonHold, eEvtMouseLeftButtonHolding, eEvtMouseRightButtonDoubleClick, eEvtMouseRightButtonDown, eEvtMouseRightButtonUp, eEvtMouseMiddleButtonDown, eEvtMouseMiddleButtonUp, eEvtMouseWheelUp and eEvtMouseWheelDown. If no mouse event is specified then the event handler is registered for all mouse events. | |||
===Flags=== | ===Flags=== | ||
===Return Values=== | ===Return Values=== | ||
None. | None. |
Latest revision as of 19:41, 11 July 2012
registerEventHandler
Registers an event handler function for a specific event.
Lua Syntax:
registerEventHandler(event, eventHandler [, eventFlags])
Arguments
event
- "string" - The event which triggers the event handler to be called. Currently supported events: "mainLoop", "mouseEvent", "animationStarted", "animationStopped", "textStarted", "textStopped".
eventHandler
- "string" - The name of the lua function which is called when the event occurs. The function for the events "animationStarted", "animationStopped", "textStarted" and "textStopped" should take exactly one argument which is the affected visionaire object.
- There are no arguments for the "mainLoop" event handler.
- The function for the "mouseEvent" takes two arguments, the first one is the mouse event (see "eventFlags" parameter) and the second argument is the current mouse position (a table containing x- and y-position).
eventFlags
- {int,...} - Can only be specified for event "mouseEvent": a list of mouse events where the event handler is called.
- Currently the following mouse events are supported: eEvtMouseMove, eEvtMouseLeftButtonDoubleClick, eEvtMouseLeftButtonDown, eEvtMouseLeftButtonUp, eEvtMouseLeftButtonHold, eEvtMouseLeftButtonHolding, eEvtMouseRightButtonDoubleClick, eEvtMouseRightButtonDown, eEvtMouseRightButtonUp, eEvtMouseMiddleButtonDown, eEvtMouseMiddleButtonUp, eEvtMouseWheelUp and eEvtMouseWheelDown. If no mouse event is specified then the event handler is registered for all mouse events.
Flags
Return Values
None.