Events
Framework control events defined in Description.json should be triggered in Control.js/ts. The name of the event must be named like the "name" of the event in Description.json. An event can be triggered in different situations, e.g. when a certain record changes (see ".onDataChanged" in the data grid).
An event is triggered in Control.js/ts via the EventProvider of the framework. The framework API function "EventProvider.raise()" is used for this purpose. When the event is triggered, the concrete control instance must be identified with "this.__id".
// raise .onMyCustomEvent event
TcHmi.EventProvider.raise(this.__id + '.onMyCustomEvent');
Optionally, parameters can be passed to the event callbacks when the event is triggered.
// declare parameter: type anything
var myParameterObject = 42;
// raise .onMyCustomEvent event with event parameters
TcHmi.EventProvider.raise(this.__id + '.onMyCustomEvent', myParameterObject);
The response to the triggered events can take place in Engineering via the Properties window or via the registration of the event in a Code Behind file.
If |