Navigation:  Basic Concepts >

Behavior and Event Handler

Previous pageReturn to chapter overviewNext page

In ForeUI, you can freely define the behavior for element(s) or page(s). The behavior can be defined as one or more event handlers. The form of event handler will look like this:


There are four factors within an event handler: Owner, Event, Flow Control and Action. They will be organized as a tree structure that represent the flow chart of behavior.

Owner indicates who will have the behavior defined by the event handler(s). It could be one or more elements, or pages. If multiple elements have the same event handlers, they behave the same. The same case could be applied on multiple pages.

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, delay or fork the flow, or make the looping. It is not mandatory in the event handler, and could be omitted when not needed.

Action is the factor that really do something. There are many kinds of actions available.

You can define as many event handlers as you need for specified element(s) or page(s). The figure below shows how a behavior tree looks like:


Custom Event

There is a special kind of event named "Custom Event", which allows you to assign a name to it and define the handler for it.  That event handler will be invoked once the custom event is triggered by action. The concept of custom event is very similar with the "function" concept in many programming languages.

Please notice that only alphabetical letters, numbers and underline can be used in the name of custom event. So "Update_Me" is a good custom event name, while "Update Me" is not.

Here's an example, two element handlers are defined for a button (Button_1). The first event is "Element Clicked", and the second event is "Button_Updated", which is a custom event.


Assume we have another button (Button_2) and we defined the event handler as below, it will trigger the "Button_Updated" custom event when it is clicked. As a result, the simulation will jump to page 1 when Button_2 is clicked.