How to access OPC from Xojo (REAL Studio, REALbasic)

From OPC Labs Knowledge Base
Jump to navigation Jump to search

It is possible to use QuickOPC-COM in an application written in Xojo, http://www.xojo.com/index_xojo.php (under Windows only). We have verified this originally with REAL Studio 2010r5, and converted to REAL Studio 2011r1.1, and later versions. The project that corresponds to the VB6 application "Quick Start", and simply reads and displays a value of an OPC item on a form, is ReadAndDisplayValue.xojo_binary_project, and the form looks like this:

Opcfromrealstudio.png

We have included this example with the product.

The actual piece of code that does the work is as simple as in most other languages:

    ' Create EasyOPC-DA component
    Dim EasyDAClient As New OleObject ("OPCLabs.EasyOpc.DataAccess.EasyDAClient")

    ' Read item value and display it
    Me.TextField1.Text = EasyDAClient.ReadItemValue("", "OPCLabs.KitServer.2", "Demo.Single")

A corresponding example for OPC Unified Architecture is also shipped with the product.

Note - Earlier URL: http://www.realsoftware.com