A common requirement during Operator interaction is that of “raising events”. For example, if something changes, then notify something else. Raising events often reduce the requirement on Timers to periodically check whether something has changed. A “listener” can simply wait for an event to be raised and then perform the required function.
Include this DLL as a reference in your script -> VIZNET.Open.GlobalEvents.dll (5 KB)
Attach to the event
UserEvents.GetInstance().GlobalEvent += Script_GlobalEvent; //Example provided in graphic form(s) below
Perform the necessary function when the event occurs. Remember to keep this function small. The event is synchronous and will wait for the function to complete before returning control to the calling function.
Detach from the event when the form is unloaded. This step is very important to prevent memory creep. Note - if the form is loaded for the duration of the session, this step is not required.
UserEvents.GetInstance().GlobalEvent -= Script_GlobalEvent;
Example(s) of how to use this functionality:
GlobalEvents.viz (23.0 KB)
ChildForm.viz (21.5 KB)