LGUI2:Hooks
Jump to navigation
Jump to search
LavishGUI 2 Hooks provide a way to attach an Event Handler to another related Element.
Defining a Hook
Each Hook must be defined with a JSON object enclosed by {}, usually as part of a "hooks" property when defining an Element.
Each item in the object is expected to be a string, except "eventHandler".
Hook properties | |
---|---|
elementType | (optional) The element type of an element to attach to |
elementName | (optional) The name of an element to attach to |
flags | (optional) Relationship flags for locating the element to attach to. "ancestor" is used by default for hooks. |
event | The name the event to attach to, in the target element |
eventHandler | An Event Handler definition |
If no optional properties are provided, the parent element (the first ancestor, as per the default flag) will be the target for the hook.
Examples
- From the default skin's checkbox definition
This hook applies the "onUnchecked" Style to the current element, when the nearest checkbox ancestor's (the checkbox containing this element) "onUnchecked" event fires.
"hooks": { "onUnchecked": { "elementType": "checkbox", "event": "onUnchecked", "eventHandler": { "type": "style", "styleName": "onUnchecked" } }
LavishGUI 2 Topics