In ForeUI, you can freely define the behavior of each element. The behavior can be defined as one or more event handlers. The form of event handler will look like this:
The event handler has three factors: Event, Flow Control and Action. They will be laid out as a tree structure that represent the flow chart of behavior.
Event is the starting point of the handler, the event handler will be invoked when the specified event is triggered.
Flow Control will take charge of the flow direction, it can branch the flow (according to condition or user's decision) or make the looping (for certain times or loop while certain condition is satisfied). It can be omitted if no branching or looping are needed.
Action is the factor that really do something. There are many kinds of actions available.
You can define many event handlers for a specified element, thus the element can respond multiple events.
There is a special kind of event named "Custom Event", you can assign a name to it and define its handler. The event handler will be invoked once the custom event is triggered, which could happen only when the corresponding "Trigger Custom Event" action is executed.
Here's an example, two element handlers are defined. The first event is "Element Clicked", and the second event is "Button Updated", which is a custom event.
If there is button with the event handler below, it will trigger the "Button Updated" custom event when it is clicked.