User-Defined Events

<< Click to Display Table of Contents >>

 

User-Defined Events

Although E3 comes with a wide range of events, there are times when users may want to create a specific event for their applications.

An example of using user-defined events would be a calculation or a more complex task in an object, when the generated event comes from another Tag or property.

Although users can create and execute this type of work from the Tag or property generating that event, there are several advantages in keeping the script next to the object that suffers this script's action. Among these advantages, there is the additional work needed to point an object to another one, not to mention the small amount of work needed in maintenance, because if by any reason it is necessary to modify or delete a Tag or property generating this event, it is not necessary to modify a second object.

Another advantage comes from the fact that if users erase the Tag generating this event, the object does not lose its script, they only need to indicate another source to generate this event.

The generation of internal events also makes the creation of libraries easier, because each time a library component is inserted in an application, it also brings scripts and calculations that can be necessary, reducing configuration work. To generate a new internal event in an object, follow these procedures:

1.Click Create new event Create new event on the list of events on the Scripts tab to open the New User Event window, shown on the next figure.

New User Event window

New User Event window

2. Type a name for this event and click OK to open this user event's View, according to the next figures, which describe the available options for this event triggering.

Whenever the expression changes its value option

Whenever the expression changes its value option

Whenever the expression is true option

Whenever the expression is true option

3. The available options on this View are described on the next table.

Available options on the user event's View

Option

Description

Name

Name that identifies this event. This option is not editable, so click Rename User Event Rename User Event to change the name of this event

Rename User Event Rename User Event

Opens a window to change the name of this event

Expression

Expression generating this event. Click Open AppBrowser to open AppBrowser and select a Tag or property, for example

Remove User Event Remove User Event

Removes this event from the List of Events. NOTE: When removing a user-defined event, all scripts associated to that event are lost

Event Triggering

Specifies a condition so that this event occurs. Possible options are Whenever the expression is true or Whenever the expression changes its value. In the first case it is an etOnEvent type (the event occurs whenever its expression is true) or an etWhileEvent type (the event occurs cyclically, at pre-defined intervals). In the second case the event is an etOnValueChanged type (the event occurs whenever its expression changes its value)

Repeat event

When available, indicates that this event is an etWhileEvent type, that is, this event repeats while its expression is true. This option is only available when the Event Triggering option is configured as Whenever the expression is true. The repetition interval is configured in the Period (ms) option

Period (ms)

Repetition interval, in milliseconds, of this event. This option is only available when the Event Triggering option is configured as Whenever the expression is true and the Repeat event option is selected

Treat disconnection as change

Indicates that a connection or disconnection of the expression generating this event must be handled as a change. This option is only available when the Event Triggering option is configured as Whenever the expression changes its value

 

4. To change this event using an object's Scripts tab, select it on the list of events. A user event can be also edited using the Edit Links option of an object's contextual menu. On the Edit Links window, click the Connection column corresponding to this event and, on the contextual menu, select the Edit option to open the window on the next figure.

Edit events window

Edit events window

Was this page useful?