Events and MethodsΒΆ
Events and Methods in UNIQO
The application logic of a Q Application is created through different features; one of these is the execution of specific actions called methods. These are called (or invoked) and executed on the occurrence of events.
Example
To increase a value after a button click, the event is the mouse click and the method is the action that causes the increase of the value.
Events
An event is a message generated at runtime to signal the occurrence of a situation. It can be used to invoke a method.
For reference information on the events, see Object and variable references.
Methods
A method is an action, a subprogram that an object can execute at runtime or at design time, as a consequence of one of the following conditions:
an event at runtime configured in Q Studio (see Managing Methods and Events in Q Studio)
an event at runtime required by a runtime C# script (see NetLogic)
a request from an OPC UA client at runtime
running a C# script at design time (see NetLogic).
It is possible to associate multiple methods with a single event: when the event occurs, the methods are invoked in the order in which they are associated with the event in Q Studio design phase.
For reference information on the methods, see Object and variable references.
Native Events
We define as native events the events present in UNIQO native object types, for example the events of the Button object.
Example
Below is how the events of the Button object are displayed in Q Studio.
Change Events
In addition to the native events, it is possible to set custom events linked to the variables, called change events.
In each object, it is possible to set a change event for each of its variables. This occurs when the value of the corresponding variable changes at runtime.
Arguments of a method
A method can have properties, called arguments. There are input arguments, which are used to specify values that the method uses during execution (for example, the increment value of a figure), and output arguments, which are values that the method returns. The value of an argument, as for variables, can be fixed or dynamic (see Dynamic Links).
Local methods
The methods of the single project objects are called local: in other words, the methods exposed by the objects. Some objects that display methods are, for example, alarms, loggers, databases and some graphical objects (e.g. the object Video Video).
Example
Below is an example of the methods exposed by a Digital Alarm object, as displayed in Q Studio.
Global methods
The methods always exposed by UNIQO are called global, regardless of the project nodes.
Example
An alarm object always exposes the Acknowledge local method, to acknowledge active alarms generated by the specific object.
Among the global methods, for example, the Acknowledge all method is available, to acknowledge the active alarms generated by all the project alarm objects.
How the global methods related to alarms are displayed in Q Studio is shown below: