There are two ways to do it.
One is with "true" events. That is, you will write an event handler that gets called when there is a notification. That will probably require the use of the EVENTHANDLER() function. I have not done this yet because it is bit longer.
The second approach is with "event pull". That is, your code asks whether there is a new notification available. I have made an example for that, and it is further below.
Note that internally in QuickOPC, BOTH these approaches are equivalent - and they both use genuine OPC UA subscriptions (change-based). The event pull approach just maintains an additional queue and gives you a different way of accessing the same flow of data.
* This example shows how to subscribe to changes of a single monitored item, pull events, and display each change.
DECLARE INTEGER GetTickCount IN kernel32
THISFORM.OutputEdit.Value = ""
* Instantiate the client object.
oClient = CREATEOBJECT("OpcLabs.EasyOpc.UA.EasyUAClient")
* In order to use event pull, you must set a non-zero queue capacity upfront.
oClient.PullDataChangeNotificationQueueCapacity = 1000
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + "Subscribing..." + CHR(13) + CHR(10)
oClient.SubscribeDataChange("http://opcua.demo-this.com:51211/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10853", 1000)
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + "Processing data change notification events for 1 minute..." + CHR(13) + CHR(10)
EndTick = GetTickCount() + 60000
DO WHILE GetTickCount() < EndTick
oEventArgs = oClient.PullDataChangeNotification(2*1000)
IF NOT ISNULL(oEventArgs)
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + oEventArgs.DisplayString + CHR(13) + CHR(10)
ENDIF
ENDDO
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + "Unsubscribing..." + CHR(13) + CHR(10)
oClient.UnsubscribeAllMonitoredItems()
THISFORM.OutputEdit.Value = THISFORM.OutputEdit.Value + "Finished." + CHR(13) + CHR(10)
If you need the other approach (event handlers), let me know.
Best regards