The UIElement class is the base class for all user interface elements such as views and controls. Don't instantiate UIElement directly but rather use one of its subclasses.
[Array] UIElement.getEventListeners(void)
Allows retrieval of the currently registered event listeners for this user interface element.
This method does not take any arguments.
An array of event listeners currently registered to the user interface element.
[void] UIElement.addEventListener(String eventType, Function listener)
Allows registration of a callback function to a user interface element in order to get notifications of events in the user interface element. Event registration can be done for a specific type of event or for all events.
eventType
The name of the event type the listener should be called for or null if all event types. The available event type names depend on the actual user interface element class that this method is caled for.
The most common event type names are ActionPerformed for button control clicks, SelectionChanged for selection controls, FocusStateChanged for all controls to indicate that focus was gained or lost and FocusedControlChanged for views to announce that a new control has been brought into (or out of) focus.
listener
The function that should be called when the specified event type occurs. The function should be defined with a single argument that will receive the event object. The object has three properties: source, type and value. The source property specifies the user interface element (e.g. control) from where the event originated. The type property contains the event type name. The contents of the value property depends between event types but contains additional information about the event. For example if the value changes in a selection control then the value property contains the new value.
This method does not return a value.
[void] UIElement.removeEventListener(String eventType, Function listener)
Allows a specific event listener to be unregistered from a user interface control.
eventType
The event type name of the listener that should be removed. Use the exact same event type name as when adding the event listener.
listener
The callback function of the listener that should be removed.
This method does not return a value.
[String] UIElement.id
The id property is a unique identifier for the user interface element. The identifier is used for the root HTML element in the element hierarchy that defines the user interface element and is useful for example in specifying specific CSS rules for a particular user interface element. The identifier can also be used to recognize the source of an event in an event callback by accessing the id property of the source property in the event object passed to the event listener callback.