Example of configuring an event script for the TagPicker control
- Last UpdatedNov 06, 2024
- 2 minute read
Install and embed the TagPicker control into a graphic as described in:
In this example, when one of the tags is picked by double-clicking on it, a message is logged in the Log Viewer.
First however, you need to:
-
Import the script function library from the file aaHistClientDatabase.dll.
-
Configure a connection to a valid and running Historian Server.
To import the script functions from aaHistClientDatabase.dll
-
On the Home ribbon, select Galaxy, then select Import.
-
Select Visualization, then Client Controls. The Import Client Controls dialog box appears.
-
Browse to the aaHistClientDatabase.dll and select it. By default, this file is in the C:\Program Files (x86)\ArchestrA\Framework\Bin\ViewAppFramework\SharedLibsfolder.
-
Click Open. The import starts and finishes with a message.
-
Click OK.
To connect the TagPicker control to the Historian Server
-
On the canvas, place a button next to the TagPicker control.
-
Double-click the button. The Edit Animations dialog box appears.
-
Add an Action Script animation to the animation list.
-
In the script area, type the following script:
Dim NewServer as ArchestrA.HistClient.Database.aaServer;
Dim statusMessage as String;
NewServer = aaTagPicker1.Servers.Add("MyHistorian");
NewServer.LoginID = "MyUserName";
NewServer.Password = "MyPassword";
NewServer.LogOn( statusMessage );
LogMessage ("Connection" + statusMessage);
In the script, replace the strings MyHistorian, MyUserName and MyPassword with the Historian server name, a valid user name, and a password to connect to the server.
-
Close the Edit Animations dialog box.
You can now configure the client control event to log a message every time the user picks one or more tags by double-clicking on them:
-
In the Industrial Graphic Editor, double-click the embedded ActiveFactory TagPicker control.
-
In the animation list, click Event.
-
In the Event list, click the OnTagsPicked event.
-
In the script area, type the following:
LogMessage("User picked one or more tags.");
-
Save and close the Edit Animations dialog box.
-
Save and close the Industrial Graphic Editor.
-
Embed the graphic in a managed InTouch application.
-
Switch to runtime and connect to a valid IndustrialSQL Server source.
-
Double-click on one of the tags in the TagPicker control.
-
Check the SMC Log Viewer. The message "User picked one or more tags" appears.