World of Hello
Public Member Functions | List of all members
event Class Reference

an event listener. More...

#include <event.h>

Inheritance diagram for event:
element CreateButton CreateCheckBox CreateContextMenu CreateDropList CreateEditBox CreateImage CreateListBox CreateScrollBar CreateTable CreateText CreateWindow

Public Member Functions

void setEventListener (ElementEvent event, function func,...)
 sets a function to run on the given event. Removes all other event listeners of the same event type. More...
 
void addEventListener (ElementEvent event, function func,...)
 adds a function to run on the given event. More...
 

Detailed Description

an event listener.

    Certain classes (such as element, mesh, and mouse) derive all of the functions in this class.\n
    This means that any element may use these by using something like "element:addEventListener(Event.onButtonPressed, function() end)".\n
    WARNING: Events are not passed through the server when an object that allows event listeners is sent.
    If you need these to send, you'll need to listen for server events and add them yourself, or add values as properties to the object and use them.\n
    NOTE: See the Events tab for usable events.

Member Function Documentation

◆ addEventListener()

void event::addEventListener ( ElementEvent  event,
function  func,
  ... 
)

adds a function to run on the given event.

   Runs the given function and passes the given arguments (if any) to the function when the event occurs.\n
   See the Events tab for the ElementEvent definition and how to use it.
Parameters
Theevent that triggers the function.
Thefunction to call when clicked.
(optional)Any number of arguments of any type to pass to the function.

◆ setEventListener()

void event::setEventListener ( ElementEvent  event,
function  func,
  ... 
)

sets a function to run on the given event. Removes all other event listeners of the same event type.

   Runs the given function and passes the given arguments (if any) to the function when the event occurs.\n
   Setting an event removes all other functions for this event. If you want to add an additional event instead, look at setEventListener().\n
   See the Events tab for the ElementEvent definition and how to use it.
Parameters
Theevent that triggers the function.
Thefunction to call when clicked.
(optional)Any number of arguments of any type to pass to the function.