Twincat EventProvider

Keep Open and Learning
Post Reply
jiataifeng
Posts: 128
Joined: 30 Apr 2009 06:31

Twincat EventProvider

Post by jiataifeng » 07 Nov 2018 00:33

put the following code in codebehind

// Register event
var destroyEvent = TcHmi.EventProvider.register('MyControl.onMyEvent',
function(evt, data) {
// Do stuff
TcHmi.Log.debug('event-data: ' + data);
// …
// Destroy to free event resources if event is no longer needed.
destroyEvent();
}
);

put the follow code in where the event is to emit.
// Raise event
TcHmi.EventProvider.raise('MyControl.onMyEvent', 42);

Post Reply