0% found this document useful (0 votes)
33 views

Visual TD Developer Reference

This document provides an overview of the object model and methods/properties for the Visual T&D Diagram Editor application. It describes the main objects (Application, Document, Pages, Page, Shapes, Shape), their relationships, and the available methods and properties for each object. The object model allows developers to programmatically interact with and modify diagrams and diagrams elements in the Visual T&D Diagram Editor.

Uploaded by

Bairon Alvira
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Visual TD Developer Reference

This document provides an overview of the object model and methods/properties for the Visual T&D Diagram Editor application. It describes the main objects (Application, Document, Pages, Page, Shapes, Shape), their relationships, and the available methods and properties for each object. The object model allows developers to programmatically interact with and modify diagrams and diagrams elements in the Visual T&D Diagram Editor.

Uploaded by

Bairon Alvira
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 159

Developer's Reference

Visual T&D
Diagram Editor
© 2011 Cooper Power Systems, LLC – All rights reserved.
The information in this document is subject to change without notice.

Cooper Power Systems


Energy Automation Solutions
730 Commerciale Street
Suite 200
Saint-Jean-Chrysostome, Quebec
Canada G6Z 2C5
Phone: +1.418.834.0009
Fax: +1.514.227.5256
Email: [email protected]
Web: http://www.cooperpower.com

Technical Support: [email protected]

GUI-00115-00031 T, version 8
Contents
1 Introduction 1

2 Visual T&D Diagram Editor Object Model 3


2.1 Overview ...............................................................................................................4

3 Application Object 7
3.1 Methods .................................................................................................................7
3.1.1 ChangeLogin Method..............................................................................7
3.1.2 GetServerName Method..........................................................................7
3.1.3 GetUserName Method ............................................................................8
3.1.4 PrintDiagram Method..............................................................................8
3.1.5 PrintPreview Method ..............................................................................8
3.1.6 PrintSetup Method ..................................................................................9
3.1.7 ShowExplorer Method ............................................................................9
3.1.8 StopAnimation Method .........................................................................10
3.1.9 UpdateAllViews Method.......................................................................10
3.1.10 UserHasPrivilege Method .......................................................10
3.1.11 ZoomIn Method ......................................................................11
3.1.12 ZoomOut Method ...................................................................12
3.1.13 ZoomTo Method .....................................................................12
3.1.14 ZoomToFit Method.................................................................12
3.2 Properties .............................................................................................................13
3.2.1 Application Property .............................................................................13
3.2.2 CurrentZoom Property ..........................................................................13
3.2.3 Name Property ......................................................................................14
3.2.4 Parent Property ......................................................................................14
3.2.5 VBAVersion Property ...........................................................................14
3.2.6 VBE Property ........................................................................................15

4 Document Object 17
4.1 Methods ...............................................................................................................17

Visual T&D Diagram Editor Developer's Reference •i


4.1.1 Close Method ........................................................................................17
4.1.2 OpenPage Method .................................................................................17
4.1.3 Previous Method ...................................................................................18
4.1.4 Save Method .........................................................................................19
4.2 Properties .............................................................................................................19
4.2.1 Application Property .............................................................................19
4.2.2 CurrentPage Property ............................................................................20
4.2.3 Name Property ......................................................................................20
4.2.4 Pages Property.......................................................................................20
4.2.5 Parent Property ......................................................................................21
4.3 Events ..................................................................................................................21
4.3.1 PageChanged Event ..............................................................................21
4.3.2 Run Event..............................................................................................22
4.3.3 Stop Event .............................................................................................22

5 Pages Object 23
5.1 Methods ...............................................................................................................23
5.1.1 Item Method ..........................................................................................23
5.2 Properties .............................................................................................................23
5.2.1 Count Property ......................................................................................24

6 Page Object 25
6.1 Properties .............................................................................................................25
6.1.1 Name Property ......................................................................................25
6.1.2 Shapes Property .....................................................................................25

7 Shapes Object 27
7.1 Methods ...............................................................................................................27
7.1.1 Item Method ..........................................................................................27
7.2 Properties .............................................................................................................27
7.2.1 Count Property ......................................................................................28

8 Shape Object 29
8.1 Methods ...............................................................................................................29
8.1.1 ForceAliasResolution Method...............................................................29
8.1.2 ForceAliasResolutionByName Method ................................................30
8.1.3 GetAlias Method ...................................................................................30
8.1.4 GetChild Method...................................................................................30

ii • Visual T&D Diagram Editor Developer's Reference


8.1.5 GetRect Method ....................................................................................31
8.1.6 GetVariableFromAlias Method .............................................................31
8.1.7 ResolveAlias Method ............................................................................32
8.1.8 ResolveAliasByName Method ..............................................................32
8.1.9 Translate Method ..................................................................................33
8.2 Properties .............................................................................................................33
8.2.1 AliasCount Property ..............................................................................33
8.2.2 Aliases Property ....................................................................................34
8.2.3 ChildCount Property .............................................................................34
8.2.4 Color Property .......................................................................................34
8.2.5 Name Property ......................................................................................35
8.2.6 Parent Property ......................................................................................35
8.2.7 Shapes Property .....................................................................................36
8.2.8 Text Property.........................................................................................36
8.2.9 Type Property ........................................................................................36
8.2.10 UserData Property...................................................................37
8.2.11 Visible Property ......................................................................38

9 Aliases Object 39
9.1 Methods ...............................................................................................................39
9.1.1 Item Method ..........................................................................................39
9.2 Properties .............................................................................................................39
9.2.1 Count Property ......................................................................................40

10 Alias Object 41
10.1 Properties .............................................................................................................41
10.1.1 IsResolved Property ................................................................41
10.1.2 Name Property ........................................................................41
10.1.3 ResolvedName Property .........................................................42

11 RTDB Object 43
11.1 Methods ...............................................................................................................43
11.1.1 CreateLogicalPoint Method ....................................................43
11.1.2 GetCmndStatusString Method ................................................44
11.1.3 GetDataPoint Method .............................................................45
11.1.4 GetDataPoints Method ............................................................45
11.1.5 GetIdFromName Method ........................................................46

Visual T&D Diagram Editor Developer's Reference • iii


11.1.6 GetNameFromId Method ........................................................46
11.1.7 GetQualityByID Method ........................................................47
11.1.8 GetQualityByName Method ...................................................47
11.1.9 GetTagByID Method ..............................................................48
11.1.10 GetTagByName Method .........................................................48
11.1.11 GetValueById Method ............................................................49
11.1.12 GetValueByName Method......................................................50
11.1.13 SendAnalogCmnd Method......................................................50
11.1.14 SendBinaryCmnd Method ......................................................51
11.1.15 SetTagById Method ................................................................53
11.1.16 SetTagByName Method..........................................................54
11.2 Properties .............................................................................................................55
11.2.1 DataPoints Property ................................................................55
11.3 Events ..................................................................................................................55
11.3.1 Connect Event .........................................................................55
11.3.2 Disconnect Event ....................................................................55

12 DataPoints Object 57
12.1 Methods ...............................................................................................................57
12.1.1 Item Method............................................................................57
12.2 Properties .............................................................................................................57
12.2.1 Count Property ........................................................................58

13 DataPoint Object 59
13.1 Properties .............................................................................................................59
13.1.1 FormattedValue Property ........................................................59
13.1.2 Id Property ..............................................................................59
13.1.3 Name Property ........................................................................60
13.1.4 Quality Property ......................................................................60
13.1.5 RawValue Property .................................................................60
13.1.6 Time Property .........................................................................61
13.1.7 Type Property .........................................................................61
13.1.8 Value Property ........................................................................62

14 AlarmManager Object 63
14.1 Methods ...............................................................................................................63
14.1.1 Acknowledge Method .............................................................63

iv • Visual T&D Diagram Editor Developer's Reference


14.1.2 AcknowledgeAll Method ........................................................64
14.1.3 AcknowledgeOldest Method ..................................................64
14.1.4 Clear Method ..........................................................................65
14.1.5 ClearAll Method .....................................................................66
14.1.6 ClearOldest Method ................................................................66
14.1.7 ClearSound Method ................................................................66
14.1.8 GetBackGroundColor Method ................................................67
14.1.9 GetDescription Method ...........................................................67
14.1.10 GetFlashingState Method........................................................68
14.1.11 GetPriorityQty Method ...........................................................69
14.1.12 GetState Method .....................................................................69
14.1.13 GetStateQty Method ...............................................................70
14.1.14 GetTextColor Method .............................................................71
14.1.15 IsAcknowledged Method ........................................................71
14.1.16 IsActive Method .....................................................................72
14.1.17 IsDisabled Method ..................................................................73
14.1.18 IsPermanent Method ...............................................................73
14.1.19 IsSilent Method .......................................................................74
14.1.20 IsSoundDisabled Method ........................................................74
14.1.21 IsSoundTriggered Method ......................................................75
14.1.22 SetDisabled Method ................................................................75
14.1.23 SetPermanent Method .............................................................75
14.1.24 SetSilent Method.....................................................................76
14.1.25 SetSoundDisabled Method......................................................76
14.2 Properties .............................................................................................................77
14.2.1 Alarms Property ......................................................................77
14.3 Events ..................................................................................................................77
14.3.1 Change Event ..........................................................................77
14.3.2 Connect Event .........................................................................78
14.3.3 Disconnect Event ....................................................................78

15 Alarms Object 79
15.1 Methods ...............................................................................................................79
15.1.1 Item Method............................................................................79
15.2 Properties .............................................................................................................79
15.2.1 Count Property ........................................................................80

Visual T&D Diagram Editor Developer's Reference •v


16 Alarm Object 81
16.1 Methods ...............................................................................................................81
16.1.1 Acknowledge Method .............................................................81
16.1.2 Clear Method ..........................................................................81
16.1.3 GetTimeString Method ...........................................................82
16.1.4 SetDisabled Method ................................................................82
16.1.5 SetPermanent Method .............................................................83
16.1.6 SetSilent Method.....................................................................83
16.2 Properties .............................................................................................................83
16.2.1 Acknowledged Property..........................................................84
16.2.2 Description Property ...............................................................84
16.2.3 FormattedValue Property ........................................................84
16.2.4 IsAcknowledged Property .......................................................85
16.2.5 IsActive Property ....................................................................85
16.2.6 IsDisabled Property.................................................................85
16.2.7 IsMultiple Property .................................................................86
16.2.8 IsPermanent Property ..............................................................86
16.2.9 IsSilent Property .....................................................................86
16.2.10 Multiple Property ....................................................................87
16.2.11 NumericValue Property ..........................................................87
16.2.12 Priority Property .....................................................................88
16.2.13 Source Property.......................................................................88
16.2.14 Time Property .........................................................................88
16.2.15 Type Property .........................................................................89

17 AlarmChanges Object 91
17.1 Methods ...............................................................................................................91
17.1.1 Item Method............................................................................91
17.2 Properties .............................................................................................................91
17.2.1 Count Property ........................................................................92

18 AlarmChange Object 93
18.1 Properties .............................................................................................................93
18.1.1 Alarm Property .......................................................................93
18.1.2 Change Property .....................................................................93

19 EventManager Object 95

vi • Visual T&D Diagram Editor Developer's Reference


19.1 Properties .............................................................................................................95
19.1.1 Events Property .......................................................................95
19.1.2 EventTypes Property...............................................................95
19.2 Events ..................................................................................................................96
19.2.1 Change Event ..........................................................................96

20 Events Object 97
20.1 Methods ...............................................................................................................97
20.1.1 Item Method............................................................................97
20.2 Properties .............................................................................................................97
20.2.1 Count Property ........................................................................98

21 EventObject Object 99
21.1 Methods ...............................................................................................................99
21.1.1 IsAlarm Method ......................................................................99
21.2 Properties .............................................................................................................99
21.2.1 AlarmState Property ............................................................. 100
21.2.2 Description Property ............................................................. 100
21.2.3 EventType Property .............................................................. 101
21.2.4 FormattedValue Property ...................................................... 101
21.2.5 Millisecond Property............................................................. 101
21.2.6 NumericValue Property ........................................................ 102
21.2.7 Source Property..................................................................... 102
21.2.8 Time Property ....................................................................... 103

22 EventTypes Object 105


22.1 Methods ............................................................................................................. 105
22.1.1 Item Method.......................................................................... 105
22.2 Properties ........................................................................................................... 105

23 EventType Object 107


23.1 Properties ........................................................................................................... 107
23.1.1 Name Property ...................................................................... 107
23.1.2 SubTypeId Property .............................................................. 107
23.1.3 TypeId Property .................................................................... 108

24 EventChanges 109
24.1 Methods ............................................................................................................. 109

Visual T&D Diagram Editor Developer's Reference • vii


24.1.1 Item Method.......................................................................... 109
24.2 Properties ........................................................................................................... 109
24.2.1 Count Property ...................................................................... 110

25 EventChange 111
25.1 Properties ........................................................................................................... 111
25.1.1 Change Property ................................................................... 111
25.1.2 EventObject Property ............................................................ 112

26 TagManager Object 113


26.1 Methods ............................................................................................................. 113
26.1.1 Add Method .......................................................................... 113
26.1.2 Clear Method ........................................................................ 114
26.1.3 Edit Method .......................................................................... 115
26.1.4 Get Method ........................................................................... 115
26.1.5 GetCount Method ................................................................. 116
26.1.6 GetNextSerialNumber Method ............................................. 117
26.1.7 GetTypeInfo Method ............................................................ 117
26.1.8 ResetSerialNumber Method .................................................. 118
26.2 Properties ........................................................................................................... 118
26.2.1 Tags Property ........................................................................ 118
26.2.2 Types Property ...................................................................... 119
26.3 Events ................................................................................................................ 119
26.3.1 Change Event ........................................................................ 119
26.3.2 Connect Event ....................................................................... 120
26.3.3 Disconnect Event .................................................................. 120

27 Tags Object 121


27.1 Methods ............................................................................................................. 121
27.1.1 Item Method.......................................................................... 121
27.2 Properties ........................................................................................................... 121
27.2.1 Count Property ...................................................................... 122

28 Tag Object 123


28.1 Methods ............................................................................................................. 123
28.1.1 Clear Method ........................................................................ 123
28.2 Properties ........................................................................................................... 123
28.2.1 Comment Property ................................................................ 123

viii • Visual T&D Diagram Editor Developer's Reference


28.2.2 Id Property ............................................................................ 124
28.2.3 object Property ...................................................................... 124
28.2.4 Owner Property ..................................................................... 125
28.2.5 Time Property ....................................................................... 125
28.2.6 Type Property ....................................................................... 125

29 TagTypes Object 127


29.1 Methods ............................................................................................................. 127
29.1.1 Item Method.......................................................................... 127
29.2 Properties ........................................................................................................... 127
29.2.1 Count Property ...................................................................... 128

30 TagType Object 129


30.1 Properties ........................................................................................................... 129
30.1.1 Action Property ..................................................................... 129
30.1.2 Color Property....................................................................... 130
30.1.3 Description Property ............................................................. 130
30.1.4 Group Property ..................................................................... 130
30.1.5 Maximum Property ............................................................... 131
30.1.6 Name Property ...................................................................... 131
30.1.7 Priority Property ................................................................... 131
30.1.8 Symbol Property ................................................................... 132
30.1.9 TagTypeId Property .............................................................. 132
30.1.10 Type Property ....................................................................... 132

31 TagChanges Object 135


31.1 Methods ............................................................................................................. 135
31.1.1 Item Method.......................................................................... 135
31.2 Properties ........................................................................................................... 135
31.2.1 Count Property ...................................................................... 136

32 TagChange Object 137


32.1 Properties ........................................................................................................... 137
32.1.1 Tag Property ......................................................................... 137
32.1.2 Change Property ................................................................... 137

33 The VBA Project 139


33.1 Adding a Module to the Project ......................................................................... 139

Visual T&D Diagram Editor Developer's Reference • ix


33.2 Adding a Procedure to a Module ....................................................................... 140
33.3 Adding a Form to the Project ............................................................................ 140

34 Programming Techniques 141


34.1 Resolving Aliases .............................................................................................. 141
34.2 Handling Mouse Events .................................................................................... 142
34.3 Displaying Diagram Pages ................................................................................ 142
34.4 Accessing Data Points ....................................................................................... 143
34.5 Displaying User Forms ...................................................................................... 143
34.6 Controlling Devices ........................................................................................... 144
34.6.1 Direct Execution Commands ................................................ 144
34.6.2 Select and Execute Commands ............................................. 145
34.7 Obtaining Milliseconds from a Date Object ...................................................... 147

x• Visual T&D Diagram Editor Developer's Reference


1 Introduction

This document provides a complete reference manual for programming Visual T&D Diagram
Editor in Visual Basic.

Visual T&D Diagram Editor Developer's Reference •1


2 Visual T&D Diagram Editor
Object Model

The main purpose of the object model is to model the Visual T&D Server management
components in an object-oriented manner. Objects are real-time representations of the server
components. Operations performed on a Visual Basic object are automatically performed on the
server. The object model is shown below:

Application

Document

Pages

Page

Shapes

Shape

Aliases

Alias

RTDB

DataPoints

DataPoint

AlarmManager

Alarms AlarmChanges

Alarm AlarmChange

TagManager

Tags TagTypes TagChanges

Tag TagType TagChange

Visual T&D Diagram Editor Developer's Reference •3


2.1 Overview
The Visual T&D Diagram Editor object model provides access to the server management
components as well as some Visual T&D Diagram Editor specific components. Collections of
objects are represented in light gray in the figure above.

Object Description
Application Represents the Visual T&D Diagram Editor application.

Document Represents the active Visual T&D Diagram Editor document.

Pages Collection of pages available in the active document.

Page Represents a page, as it exists in the active document.

Shapes Collection of shapes. This object is accessible:

‰ through a Shape object and represents children of this shape;


‰ through a Page object and represents the collection of shapes available in
this page.

Shape Represents a Visual T&D Diagram Editor shape. This object is accessible only
through a Visual T&D Diagram Editor event.

Aliases Collection of aliases available in a shape.

Alias Represents an alias attached to an existing shape.

RTDB Real-Time Database. Represents all the data points monitored by the
Visual T&D Server.

DataPoints Collection of data points.

DataPoint Represents a data point, as it exists on the Visual T&D Server.

AlarmManager Represents the alarm manager responsible of managing all alarms.

Alarms Collection of alarms.

Alarm Represents an alarm, as it exists on the Visual T&D Server.

AlarmChanges Collection of alarm changes. This object is accessible only through the Change
event of the AlarmManager.

AlarmChange Represents a change that occurred on an alarm. Changes include: a new alarm,
acknowledging an alarm, clearing an alarm, a change of state for an alarm, etc.

TagManager Represents the tag manager, responsible for managing all tags.

Tags Collection of tags.

Tag Represents a tag, as it exists on the Visual T&D Server.

TagTypes Collection of tag types.

4• Visual T&D Diagram Editor Developer's Reference


TagType Represents a tag type.

TagChanges Collection of tag changes. This object is accessible only through the Change
event of the TagManager.

TagChange Represents a change that occurred on a tag. Changes include: a new tag,
modifying an existing tag, and deleting a tag.

Visual T&D Diagram Editor Developer's Reference •5


3 Application Object

The Application object represents the Visual T&D Diagram Editor application. This object is
accessible through the Application property of the Document object.

3.1 Methods
The Application object provides several methods to access application information and perform
various actions related to the application features.

3.1.1 ChangeLogin Method


Prompts the user to reconnect using a different account.

Syntax

Application.ChangeLogin

The ChangeLogin method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Reconnect… command of the application's File
menu.

3.1.2 GetServerName Method


Returns the name of the server the application is currently connected to.

Syntax

String = Application.GetServerName

Visual T&D Diagram Editor Developer's Reference •7


The GetServerName method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method returns a String that contains the name of the server to which the application is
currently connected.

3.1.3 GetUserName Method


Returns the name of the user currently logged in.

Syntax

String = Application.GetUserName

The GetUserName method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method returns a String that contains the name of the user that is currently logged in to the
server.

3.1.4 PrintDiagram Method


Prints the active page.

Syntax

Application.PrintDiagram

The PrintDiagram method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Print command of the application's File menu.

3.1.5 PrintPreview Method


Launches the print preview for the active page.

8• Visual T&D Diagram Editor Developer's Reference


Syntax

Application.PrintPreview

The PrintPreview method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Print Preview command of the application's File
menu.

3.1.6 PrintSetup Method


Launches the print setup for the active page.

Syntax

Application.PrintSetup

The PrintSetup method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Print Setup command of the application's File
menu.

3.1.7 ShowExplorer Method


Launches Visual T&D Explorer.

Syntax

Application.ShowExplorer

The ShowExplorer method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Explorer command of the application's Tools menu.

Visual T&D Diagram Editor Developer's Reference •9


3.1.8 StopAnimation Method
Returns the application in the edition mode.

Syntax

Boolean = Application.ShowExplorer

The ShowExplorer method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Execute command of the application's Animation
menu. Returns True if it succeeds, and False if an error occurs.

3.1.9 UpdateAllViews Method


Tells the application to update all views.

Syntax

Application.UpdateAllViews

The UpdateAllViews method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method tells the application to update the contents of all views that are displayed. It can be
used to refresh the display when shape properties are changed in animation mode by VBA
routines.

3.1.10 UserHasPrivilege Method


Verifies if the user account currently in use has the specified privilege.

Syntax

Boolean = Application.UserHasPrivileges Privilege

10 • Visual T&D Diagram Editor Developer's Reference


The UserHasPrivilege method syntax has the following part:

Part Description
Application Required. A valid Application object.

Privilege Required. A USER_PRIVILEGE enumeration value identifying the privilege.

Settings

The Privilege parameter can be any of the following:

Value Description
USER_PRIVILEGE_NONE Any privilege. This value will verify if the user
account has at least one privilege.

USER_PRIVILEGE_EDIT_SITE_CONFIG Corresponds to the “User can edit site


configuration” privilege.

USER_PRIVILEGE_CONTROL_OPERATION Corresponds to the “User can perform control


operations” privilege.

USER_PRIVILEGE_MANAGE_ALARM Corresponds to the “User can acknowledge and


clear alarms” privilege.

USER_PRIVILEGE_SIMULATE_DATA Correspond to the “User can simulate data”


privilege.

USER_PRIVILEGE_MODIFY_STARTUP_OPTIONS Correspond to the “User can modify startup


options” privilege.

USER_PRIVILEGE_EDIT_ALARM Correspond to the “User can set silent, permanent


and blocked alarms” privilege.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm of the specified type must
exist for the specified point. Returns True if the user account has the specified privilege, and False
otherwise.

3.1.11 ZoomIn Method


Zooms in the active page.

Syntax

Application.ZoomIn

The ZoomIn method syntax has the following part:

Part Description
Application Required. A valid Application object.

Visual T&D Diagram Editor Developer's Reference • 11


Remarks

This method performs the same action as the Zoom In command of the application's View menu.

3.1.12 ZoomOut Method


Zooms out the active page.

Syntax

Application.ZoomOut

The ZoomOut method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Zoom Out command of the application's View
menu.

3.1.13 ZoomTo Method


Applies the specified scaling factor to active page.

Syntax

Application.ZoomTo zoomValue

The ZoomTo method syntax has the following part:

Part Description
Application Required. A valid Application object.

zoomValue Required. An Integer representing the scaling factor to apply, in percent.

Remarks

This method performs the same action as the predefined zoom value commands (50%, 75%,
100%, etc,) available from the application's View menu.

3.1.14 ZoomToFit Method


Zooms the active page so that all shapes are visible.

12 • Visual T&D Diagram Editor Developer's Reference


Syntax

Application.ZoomToFit

The ZoomToFit method syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

This method performs the same action as the Zoom To Fit command of the application's View
menu.

3.2 Properties
The Application object has some properties to manage the application.

3.2.1 Application Property


Retrieves the global application object. Retrieve exactly the same object.

Syntax

Application.Application

The Application property syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

The Application property is a read-only property.

3.2.2 CurrentZoom Property


Retrieves the zoom factor that is currently applied to the active page.

Syntax

Application.CurrentZoom

The CurrentZoom property syntax has the following part:

Visual T&D Diagram Editor Developer's Reference • 13


Part Description
Application Required. A valid Application object.

Remarks

The CurrentZoom property is a read-only property.

3.2.3 Name Property


Retrieves the application name.

Syntax

Application.Name

The Name property syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

The Name property is a read-only property.

3.2.4 Parent Property


Retrieves the parent application object. Retrieve exactly the same object.

Syntax

Application.Parent

The Parent property syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

The Parent property is a read-only property.

3.2.5 VBAVersion Property


Retrieves the version of Visual Basic for Application.

14 • Visual T&D Diagram Editor Developer's Reference


Syntax

Application.VBAVersion

The VBAVersion property syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

The VBAVersion property is a read-only property.

3.2.6 VBE Property


Retrieves the extension object of the Visual Basic Editor.

Syntax

Application.VBE

The VBE property syntax has the following part:

Part Description
Application Required. A valid Application object.

Remarks

The VBE property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 15


4 Document Object

The Document object represents the active Visual T&D Diagram Editor document. Only one
document can be active at any given time in Visual T&D Diagram Editor.

4.1 Methods
The Document object provides several methods for navigating through the pages of a document
while in animation mode.

4.1.1 Close Method


Closes the diagram page and the associated window, if possible. The main page cannot be closed.

Syntax

Boolean = Document.Close

The Close method syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

This method closes the active window only. There is no way to determine which page/window
will be closed if this method is not used in an event that also activates a page, such as a click or a
double click. The main page cannot be closed. This method returns True if it succeeds, and False
if an error occurs. Furthermore, it raises an error flag before returning False.

4.1.2 OpenPage Method


Opens a page in the document. The window in which the page is open depends on the page type. If
a new window is not created, the page is opened in the active window.

Visual T&D Diagram Editor Developer's Reference • 17


Syntax

Boolean = Document.OpenPage PageName, nZoomFactor, nTop, nLeft,


nBottom, nRight, ResolutionHint

The OpenPage method syntax has the following parts:

Part Description
Document Required. A valid Document object.

PageName Required. The name of the page to open.

nZoomFactor Optional. The zoom factor to apply to the page once it is open. If omitted, it defaults to
100.

nTop Optional. Top position on the screen, where the page is to be opened. If omitted, defaults
to –1 (which means: use default value).

nLeft Optional. Left position on the screen, where the page is to be opened. If omitted, defaults
to –1 (tells the application to use its default value).

nBottom Optional. Bottom position on the screen, where the page is to be opened. If omitted,
defaults to –1 (tells the application to use its default value).

nRight Optional. Right position on the screen, where the page is to be opened. If omitted,
defaults to –1 (tells the application to use its default value).

ResolutionHint Optional. If the page is a renaming page, the renaming table to use. If omitted, defaults to
an empty string. This parameter is ignored if the page is not a renaming page.

Remarks

If any of nTop, nLeft, nBottom or nRight is specified, all values must be supplied to be taken into
account. This method returns True if it succeeds and False if an error occurs. Furthermore, it
raises an error flag before returning False.

4.1.3 Previous Method


This method is used to navigate to the previous page displayed in the active window. It has no
effect if only one page is displayed.

Syntax

Boolean = Document.Previous

The Previous method syntax has the following part:

Part Description
Document Required. A valid Document object.

18 • Visual T&D Diagram Editor Developer's Reference


Remarks

This method returns True if it succeeds and False if an error occurs. Furthermore, it raises an error
flag before returning False.

4.1.4 Save Method


This method can be used in order to save the active document. However, in practice, this is
impossible because the document cannot be saved while in animation mode.

Syntax

Document.Save

The Save method syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

This method is useless, as it cannot save a document while in animation mode.

4.2 Properties

4.2.1 Application Property


Retrieves the Application object.

Syntax

Document.Application

The Application property syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

The Application property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 19


4.2.2 CurrentPage Property
Retrieves the currently displayed page.

Syntax

Page = Document.CurrentPage

The CurrentPage property syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

The CurrentPage property is a read-only property.

4.2.3 Name Property


Retrieves the document name.

Syntax

Document.Name

The Name property syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

The Name property is a read-only property.

4.2.4 Pages Property


Retrieves a collection of all available pages in the active document.

Syntax

Pages = Document.Pages

The Pages property syntax has the following part:

Part Description
Document Required. A valid Document object.

20 • Visual T&D Diagram Editor Developer's Reference


Remarks

The Pages property is a read-only property.

4.2.5 Parent Property


Retrieves the parent of the document. For Visual T&D Diagram Editor, the parent is always the
application.

Syntax

Document.Parent

The Parent property syntax has the following part:

Part Description
Document Required. A valid Document object.

Remarks

The Parent property is a read-only property.

4.3 Events
The Document object generates events when a page is opened, and when the animation mode is
started and stopped.

4.3.1 PageChanged Event


This event is generated every time a page is opened through the OpenPage method of Document.

Syntax

Sub Document_PageChanged(ByVal NewPage As String, ByVal NewHint


As String)

The PageChanged event syntax has the following parts:

Part Description
Document Required. A valid Document object.

NewPage Required. The name of the page opened. This is the same as the PageName parameter of the
OpenPage method.

NewHint Required. The renaming table name used when the page was opened.

Visual T&D Diagram Editor Developer's Reference • 21


Remarks

This event is generated only if the OpenPage method was successful.

4.3.2 Run Event


This event is generated each time animation mode is started.

Syntax

Sub Document_Run()

The Run event syntax has the following parts:

Part Description
Document Required. A valid Document object.

Remarks

This event is generated each time animation mode is started.

4.3.3 Stop Event


This event is generated each time animation mode is stopped.

Syntax

Sub Document_Stop()

The Stop event syntax has the following parts:

Part Description
Document Required. A valid Document object.

Remarks

This event is generated each time animation mode is stopped.

22 • Visual T&D Diagram Editor Developer's Reference


5 Pages Object

The Pages object is the collection of Page objects that are available from the Document object.
As for every collection, it can be used in a For … Each construct.

5.1 Methods
The Pages object defines the usual methods for a collection.

5.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Pages object.

itemIndex Required. The index of the item to get. Only numeric values are allowed. The first
page is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Page object if itemIndex is valid, otherwise it is Nothing.

5.2 Properties
The Pages object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 23


5.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Pages object.

Remarks

The Count property is a read-only property.

24 • Visual T&D Diagram Editor Developer's Reference


6 Page Object

A Page object represents a page of a Visual T&D Diagram Editor document. Page objects are
obtained from a Pages collection.

A Page object can be used directly in a For … Each construct to iterate through all the children.

6.1 Properties

6.1.1 Name Property


Retrieves the name of the page.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid Page object.

Remarks

The Name property is a read-only property.

6.1.2 Shapes Property


Retrieves all shape available in this page.

Syntax

object.Shapes

Visual T&D Diagram Editor Developer's Reference • 25


The Shapes property syntax has the following part:

Part Description
Object Required. A valid Page object.

Remarks

The collection returned may be empty if this page has no shape.

26 • Visual T&D Diagram Editor Developer's Reference


7 Shapes Object

A Shapes object is a collection of Shape objects obtained either from a Shape object when an
event generated by Visual T&D Diagram Editor is raised, or from a Page object. As for every
collection, it can be used in a For … Each construct. It represents the collection of children of the
Shape from which it is obtained, or the collection of shapes available in a Page object.

7.1 Methods
The Shapes object defines the usual methods for a collection.

7.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Shapes object.

itemIndex Required. The index of the shape to get. Only numeric values are allowed. The first
shape is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Shape object if itemIndex is valid, otherwise it is Nothing.

7.2 Properties
The Shapes object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 27


7.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Shapes object.

Remarks

The Count property is a read-only property.

28 • Visual T&D Diagram Editor Developer's Reference


8 Shape Object

A Shape object represents a shape on a page of a Visual T&D Diagram Editor document. Shape
objects are obtained when an event is generated by Visual T&D Diagram Editor, such as a click, a
double-click, a mouse enter, etc.

A Shape object can be used directly in a For … Each construct to iterate through all the children.

8.1 Methods

8.1.1 ForceAliasResolution Method


Resolves an alias to a specific data point, regardless of the resolution type (automatic or manual)
that has been configured for the alias.

Syntax

Boolean = object.ForceAliasResolution Alias, VariableName

The ForceAliasResolution method syntax has the following parts:

Part Description
object Required. A valid Shape object.

Alias Required. The index of the alias to resolve.

VariabledName Required. The data point name to which the alias is to be bound.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

Visual T&D Diagram Editor Developer's Reference • 29


8.1.2 ForceAliasResolutionByName Method
Resolves an alias to a specific data point, regardless of the resolution type (automatic or manual)
that has been configured for the alias.

Syntax

Boolean = object.ForceAliasResolution AliasName, VariableName

The ForceAliasResolution method syntax has the following parts:

Part Description
object Required. A valid Shape object.

AliasName Required. The name of the alias to resolve.

VariabledName Required. The data point name to which the alias is to be bound.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

8.1.3 GetAlias Method


This method provides access to information about an alias.

Syntax

Boolean = object.GetAlias Alias, AliasName

The GetAlias method syntax has the following parts:

Part Description
object Required. A valid Shape object.

Alias Required. The index of the alias to get. The first alias is at index 1, the second, at
index 2, etc.

AliasName Required. Will be initialized to the name of the alias.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

8.1.4 GetChild Method


Retrieves a specific child of the shape.

30 • Visual T&D Diagram Editor Developer's Reference


Syntax

Shape = object.GetChild nChild

The GetChild method syntax has the following parts:

Part Description
object Required. A valid Shape object.

nChild Required. The index of the child to get. The first child is at index 1, the second, at
index 2, etc.

Remarks

This method raises an error flag if it fails. This method is not recommended. The use of the
Shapes property is the recommended method.

8.1.5 GetRect Method


Retrieves the bounding rectangle of the shape. The coordinates are aligned with the upper left
corner of the page and are given in pixels.

Syntax

object.GetRect Left, Top, Right, Bottom

The GetRect method syntax has the following parts:

Part Description
object Required. A valid Shape object.

Left Required. Will be initialized to the left coordinate of the bounding rectangle.

Top Required. Will be initialized to the top coordinate of the bounding rectangle.

Right Required. Will be initialized to the right coordinate of the bounding rectangle.

Bottom Required. Will be initialized to the bottom coordinate of the bounding rectangle.

8.1.6 GetVariableFromAlias Method


Retrieves, from an alias, the corresponding data point name.

Syntax

Boolean = object.GetVariableFromAlias AliasName, ResolvedName

Visual T&D Diagram Editor Developer's Reference • 31


The GetVariableFromAlias method syntax has the following parts:

Part Description
object Required. A valid Shape object.

AliasName Required. The alias for which to get the corresponding data point name.

ResolvedName Required. Will be initialized to the data point name corresponding to the alias.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

8.1.7 ResolveAlias Method


Resolves an alias to a specific data point.

Syntax

Boolean = object.ResolveAlias Alias, VariableName

The ResolveAlias method syntax has the following parts:

Part Description
object Required. A valid Shape object.

Alias Required. The index of the alias to resolve.

VariabledName Required. The data point name to which the alias is to be bound.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

The method will also return a false if the alias it tries to resolve is not configured in automatic
resolution.

8.1.8 ResolveAliasByName Method


Resolves an alias to a specific data point.

Syntax

Boolean = object.ResolveAliasByName AliasName, VariableName

32 • Visual T&D Diagram Editor Developer's Reference


The ResolveAliasByName method syntax has the following parts:

Part Description
object Required. A valid Shape object.

AliasName Required. The name of the alias to resolve.

VariabledName Required. The data point name to which the alias is to be bound.

Remarks

This method returns True if it succeeds and False if an error occurred. Furthermore, it raises an
error flag before returning False.

The method will also return a false if the alias it tries to resolve is not configured in automatic
resolution.

8.1.9 Translate Method


Translates the shape.

Syntax

object.Translate TranslateX, TranslateY

The Translate method syntax has the following parts:

Part Description
object Required. A valid Shape object.

TranslateX Required. The horizontal translation. Positive value moves right, negative, left.

TranslateY Required. The vertical translation. Positive value moves downward, negative,
upward.

8.2 Properties

8.2.1 AliasCount Property


Retrieves the number of aliases accessible from this shape.

Syntax

object.AliasCount

Visual T&D Diagram Editor Developer's Reference • 33


The AliasCount property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The AliasCount property is a read-only property.

8.2.2 Aliases Property


Retrieves a collection of all alias accessible from this shape.

Syntax

Aliases = object.Aliases

The Pages property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The collection returned may be empty if no aliases are used within this shape.

8.2.3 ChildCount Property


Retrieves the number of children accessible from this shape.

Syntax

object.ChildCount

The ChildCount property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The ChildCount property is a read-only property. This property is unrecommended. The use of
the Shapes property is recommended.

8.2.4 Color Property


Retrieves the color of the shape.

34 • Visual T&D Diagram Editor Developer's Reference


Syntax

object.Color

The Color property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The Color property is a read-only property.

8.2.5 Name Property


Retrieves the name of the shape. Each shape has a name, which is automatically assigned by
Visual T&D Diagram Editor and can later be changed by user.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The Name property is a read-only property.

8.2.6 Parent Property


Retrieves the parent of the shape.

Syntax

object.Parent

The Parent property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The Parent property is a read-only property. The parent of a shape may be Nothing if the shape
has no parent.

Visual T&D Diagram Editor Developer's Reference • 35


8.2.7 Shapes Property
Retrieves all the children of the shape.

Syntax

object.Shapes

The Shapes property syntax has the following part:

Part Description
object Required. A valid Shape object.

Remarks

The collection returned may be empty if this shape has no children.

8.2.8 Text Property


Retrieves the text of the shape.

Syntax

object.Text

The Text property syntax has the following part:

Part Description
Object Required. A valid Shape object.

Remarks

The Text property is a writable property.

8.2.9 Type Property


Retrieves the type of the shape.

Syntax

object.Type

The Type property syntax has the following part:

Part Description
object Required. A valid Shape object.

36 • Visual T&D Diagram Editor Developer's Reference


Settings

The Type property can take any of the following values:

Value Description
SHAPE_CURVE Closed curve

SHAPE_CURVED_LINE Polycurve

SHAPE_ELLIPSE Ellipse

SHAPE_GROUP Group of shapes

SHAPE_LINE Line

SHAPE_LINK Link between two shapes

SHAPE_POLYGON Polygon

SHAPE_RECTANGLE Rectangle

SHAPE_TEXT Text

SHAPE_IMAGE Image

SHAPE_UNKNOWN Unknown type

Remarks

The Type property is a read-only property.

8.2.10 UserData Property


Set or retrieves user data associated with the shape. User data is not saved with the document.

Syntax

object.UserData [= Variant]

The UserData property syntax has the following parts:

Part Description
object Required. A valid Shape object.

Variant Optional. The user data to associate with the shape.

Remarks

The UserData property is not saved with the document.

Visual T&D Diagram Editor Developer's Reference • 37


8.2.11 Visible Property
Sets or retrieves the visibility of the shape.

Syntax

object.Visible [= Boolean]

The Visible property syntax has the following parts:

Part Description
object Required. A valid Shape object.

Boolean Optional. True to make the shape visible, False to hide it.

Remarks

The Visible property is affected by animation of the shape. It does not consider whether the page
on which the shape is located, is displayed.

38 • Visual T&D Diagram Editor Developer's Reference


9 Aliases Object

An Aliases object is a collection of Alias objects obtained from a Shape object. As for every
collection, it can be used in a For … Each construct. It represents the collection of aliases defined
in the Shape from which it is obtained.

9.1 Methods
The Aliases object defines the usual methods for a collection.

9.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Aliases object.

itemIndex Required. The index of the alias to get. Only numeric values are allowed. The first
alias is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Alias object if itemIndex is valid, otherwise it is Nothing.

9.2 Properties
The Aliases object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 39


9.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Aliases object.

Remarks

The Count property is a read-only property.

40 • Visual T&D Diagram Editor Developer's Reference


10 Alias Object

An Alias object represents an alias of a shape, in a page of a Visual T&D Diagram Editor
document. An Alias object can be used directly in a For … Each construct to iterate through all
the children.

10.1 Properties

10.1.1 IsResolved Property


Indicates whether the alias is resolved or not.

Syntax

object.IsResolved

The IsResolved property syntax has the following part:

Part Description
Object Required. A valid Alias object.

Remarks

The IsResolved property is a read-only property.

10.1.2 Name Property


Retrieves the name of the alias.

Syntax

object.Name

Visual T&D Diagram Editor Developer's Reference • 41


The Name property syntax has the following part:

Part Description
object Required. A valid Alias object.

Remarks

The Name property is a read-only property.

10.1.3 ResolvedName Property


Retrieves the name of the data point associated to this alias.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid Alias object.

Remarks

The ResolvedName property is a read-only property.

42 • Visual T&D Diagram Editor Developer's Reference


11 RTDB Object

The RTDB object represents the Visual T&D Server real-time database. All monitored points are
grouped in this object. You can also create local points that are not managed by the Visual T&D
Server.

11.1 Methods
The RTDB object provides several methods for accessing and manipulating data points.

11.1.1 CreateLogicalPoint Method


Creates a logical point in the local real-time database. A logical point has no physical connection
and exists only when the Visual T&D Diagram Editor application is connected to a server.

Syntax

Boolean = RTDB.CreateLogicalPoint ptName, pointType, initValue

The CreateLogicalPoint method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ptName Required. A string representing the point name. This name must be unique among all points
and must not be empty.

pointType Required. A POINT_TYPE enumeration value representing the point type.

initValue Required. The initial value of the point.

Visual T&D Diagram Editor Developer's Reference • 43


Settings

The settings for pointType are:

Value Description
POINT_TYPE_ANALOG_INPUT An input analog point. This point can assume any value, but it is
not possible to command it.

POINT_TYPE_ANALOG_OUTPUT An output analog point. This point can assume any value and it is
possible to command it.

POINT_TYPE_DIGITAL_INPUT A binary point. This point can only have two values (True or False)
and it is not possible to command it.

POINT_TYPE_ANALOG_OUTPUT A binary point. This point can only have two values (True or False)
and it is possible to command it.

Remarks

A logical point exists only locally and must be created each time the Connect event of RTDB is
called.

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

11.1.2 GetCmndStatusString Method


Retrieves, from a status value returned by SendAnalogCmnd or SendBinaryCmnd, the
corresponding textual description.

Syntax

Boolean= RTDB.GetCmndStatusString status, cmndStatusString

The GetCmndStatusString method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

status Required. A Long value returned by a call to SendAnalogCmnd or SendBinaryCmnd.

cmndStatusString Required. A string that will be initialized to the textual description of the status.

Remarks

This method is deprecated. The use of the Err object is recommended.

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

44 • Visual T&D Diagram Editor Developer's Reference


11.1.3 GetDataPoint Method
Retrieves a data point object from its name.

Syntax

DataPoint = RTDB.GetDataPoint PointName

The GetDataPoint method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

Remarks

This method raises an error flag if the specified data point does not exist.

11.1.4 GetDataPoints Method


Retrieves the specified data points.

Syntax

DataPoints = RTDB.GetDataPoints Types, Filter

The GetDataPoints method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

Types Required. A POINT_TYPE_MASK enumeration value (or a combination thereof)


identifying which types of data point to get.

Filter Required. A string used to filter the list of data points that are to be returned. If the
string is empty, all data points of the specified types are returned.

Settings

The Types parameter can assume the following values:

Value Description
MASK_ALL Retrieves data points of all types.

MASK_ANALOG Retrieves all analog data points (input and output).

MASK_ANALOG_INPUT Retrieves all analog input data points.

MASK_ANALOG_OUTPUT Retrieves all analog output data points.

Visual T&D Diagram Editor Developer's Reference • 45


MASK_DIGITAL Retrieves all digital data points (input and output).

MASK_DIGITAL_INPUT Retrieves all digital input data points.

MASK_DIGITAL_OUTPUT Retrieves all digital output data points.

MASK_INPUT Retrieves all input data points (analog and digital).

MASK_OUTPUT Retrieves all output data points (analog and digital).

Remarks

This method raises an error flag if it fails. The returned collection may be empty if no data points
matches the search criteria specified.

11.1.5 GetIdFromName Method


Retrieves the internal ID of a point from its name. This can prove useful, as accessing a point
through its internal ID is more efficient than accessing it through its name.

Syntax

Boolean = RTDB.GetIdFromName PointName, ID

The GetIdFromName method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

ID Required. An Integer that will be initialized to the internal ID of the point.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the ID returned is not valid and you can assume the point does
not exist.

11.1.6 GetNameFromId Method


Retrieves the point name from its internal ID.

Syntax

Boolean = RTDB.GetNameFromId ID, PointName

46 • Visual T&D Diagram Editor Developer's Reference


The GetNameFromId method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ID Required. An Integer representing the internal ID of the point.

PointName Required. A string that will be initialized to the name of the point.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the name returned is not valid and you can assume the ID is
invalid.

11.1.7 GetQualityByID Method


Retrieves the acquisition quality of a point based on its internal ID.

Syntax

Boolean = RTDB.GetQualityByID ID, Quality

The GetQualityByID method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ID Required. An Integer that will be initialized to the internal ID of the point.

Quality Required. A Variant that will be initialized to the acquisition quality of the point.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the quality returned is not valid and you can assume the ID is
invalid.

11.1.8 GetQualityByName Method


Retrieves the acquisition quality of a point based on its name.

Syntax

Boolean = RTDB.GetQualityByName PointName, Quality

Visual T&D Diagram Editor Developer's Reference • 47


The GetQualityByName method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

Quality Required. A Variant that will be initialized to the acquisition quality of the point.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the quality returned is not valid and you can assume the point
does not exist.

11.1.9 GetTagByID Method


Retrieves the value of a data point tag based on the point internal ID.

Syntax

Boolean = RTDB.GetTagByID ID, Tag, TagOn

The GetTagByID method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ID Required. An Integer representing the internal ID of the point.

Tag Required. An Integer representing the tag to verify.

TagOn Required. A Boolean that will be initialized to True if a tag exists.

Settings

The Tag parameter can assume any value from 1 to 16, each representing a specific bit.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the value returned is not valid and you can assume the internal
ID is invalid.

This method is deprecated. The use of the TagManager is recommended.

11.1.10 GetTagByName Method


Retrieves the value of a data point tag based on the point name.

48 • Visual T&D Diagram Editor Developer's Reference


Syntax

Boolean = RTDB.GetTagByName PointName, Tag, TagOn

The GetTagByName method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

Tag Required. An Integer representing the tag to verify.

TagOn Required. A Boolean that will be initialized to True if a tag exists.

Settings

The Tag parameter can assume any value from 1 to 16, each representing a specific bit.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the value returned is not valid and you can assume the point
does not exist.

This method is deprecated. The use of the TagManager is recommended.

11.1.11 GetValueById Method


Retrieves the current value of a point based on its internal ID.

Syntax

Boolean = RTDB.GetValueById ID, Value

The GetValueById method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ID Required. An Integer representing the internal ID of the point.

Value Required. A Variant that will be initialized to the current point value.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the value returned is not valid and you can assume the ID is
invalid.

Visual T&D Diagram Editor Developer's Reference • 49


11.1.12 GetValueByName Method
Retrieves the current value of a point based on its name.

Syntax

Boolean = RTDB.GetValueByName PointName, Value

The GetValueByName method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

Value Required. A Variant that will be initialized to the current point value.

Remarks

This method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False. If it returns False, the value returned is not valid and you can assume the point
does not exist.

11.1.13 SendAnalogCmnd Method


Execute a command on an analog output point.

Syntax

Boolean = RTDB.SendAnalogCmnd PointName, cmndType, value, status,


timeout

The SendAnalogCmnd method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

cmndType Required. A CMND_TYPE_CODE representing the type of command to execute.

Value Required. A Variant representing the new value of the point.

status Required. A Long that will be initialized to the execution status of the command. If this
number is different from 0 once the method is executed, use the GetCmndStatusString
method to get a textual description.

timeout Required. A Long value representing the timeout, in milliseconds, allowed before
command execution fails. This parameter is dependent on the device with which the data
point is associated and may be ignored.

50 • Visual T&D Diagram Editor Developer's Reference


Settings

The status value indicates whether or not the call was successful. Here are the possible ranges and
their meaning:

Value Description
Between 0 and 1000H Operation succeeded.

Between 1000H and 2000H Operation failed.

Between 2000H and 3000H Operation rejected.

The possible values for cmndType are:

Value Description
CMND_TYPE_DIRECT_EXECUTE Direct execution of the command.

CMND_TYPE_DIRECT_EXECUTE_LOGICAL Direction execution of the command. In addition, the


command is validated locally before being executed by
the device.

CMND_TYPE_EXECUTE Execution part of a “Select-before-operate” command.

CMND_TYPE_EXECUTE_LOGICAL Execution part of a “Select-before-operate” command.


In addition, the command is validated locally before
being executed by the device.

CMND_TYPE_RECALL – not implemented yet Not yet implemented. Recall a


CMND_TYPE_RESERVE or
CMND_TYPE_SELECT command.

CMND_TYPE_RESERVE – not implemented Not yet implemented. Reserve the point for a
yet command.

CMND_TYPE_SELECT Selection part of a “Select-before-operate” command.

CMND_TYPE_SELECT_LOGICAL Selection part of a “Select-before-operate” command.


In addition, the command is validated locally before
being executed by the device.

Remarks

The method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

The allowed values for cmndType depend on the data source with which the point is associated.

11.1.14 SendBinaryCmnd Method


Execute a command on a binary output point.

Visual T&D Diagram Editor Developer's Reference • 51


Syntax

Boolean = RTDB.SendBinaryCmnd PointName, cmndType, execType,


status, param, timeout

The SendBinaryCmnd method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

cmndType Required. A CMND_TYPE_CODE representing the type of command to execute.

execType Required. An EXEC_TYPE representing the execution type.

status Required. A Long that will be initialized to the execution status of the command. If this
number is different from 0 once the method is executed, use the GetCmndStatusString
method to get a textual description.

param Required. A Long value. The interpretation of this parameter depends on the
combination of cmndType and execType and may be ignored.

timeout Required. A Long value representing the timeout, in milliseconds, allowed before
command execution fails. This parameter is dependent of the device to which the data
point is associated and may be ignored.

Settings

The status value indicates whether or not the call was successful. Here are the possible ranges and
their meaning:

Value Description
Between 0 and 1000H Operation succeeded.

Between 1000H and 2000H Operation failed.

Between 2000H and 3000H Operation rejected.

The possible values for cmndType are:

Value Description
CMND_TYPE_DIRECT_EXECUTE Direct execution of the command.

CMND_TYPE_DIRECT_EXECUTE_LOGICAL Direction execution of the command. In addition, the


command is validated locally before being executed by
the device.

CMND_TYPE_EXECUTE Execution part of a “Select-before-operate” command.

CMND_TYPE_EXECUTE_LOGICAL Execution part of a “Select-before-operate” command.


In addition, the command is validated locally before
being executed by the device.

52 • Visual T&D Diagram Editor Developer's Reference


Value Description
CMND_TYPE_RECALL – not implemented yet Not yet implemented. Recall a
CMND_TYPE_RESERVE or
CMND_TYPE_SELECT command.

CMND_TYPE_RESERVE – not implemented Not yet implemented. Reserve the point for a
yet command.

CMND_TYPE_SELECT Selection part of a “Select-before-operate” command.

CMND_TYPE_SELECT_LOGICAL Selection part of a “Select-before-operate” command.


In addition, the command is validated locally before
being executed by the device.

The possible values for execType are:

Value Description
EXEC_TYPE_NONE No execution. The cmndType is sufficient.

EXEC_TYPE_OPEN Executes an open command. The exact meaning depends on the device
to which the data point is associated.

EXEC_TYPE_CLOSE Executes a close command. The exact meaning depends on the device
to which the data point is associated.

EXEC_TYPE_PULSE Generates a pulse on the point.

Remarks

The method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

The values allowed for cmndType and execType depend on the data source with which the point is
associated.

11.1.15 SetTagById Method


Sets/resets a data point tag based on the point internal ID.

Syntax

Boolean = RTDB.SetTagById ID, Tag, TagOn, Comment

The SetTagById method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ID Required. An Integer representing the point's internal ID.

Tag Required. An Integer representing the data point tag to set/reset.

Visual T&D Diagram Editor Developer's Reference • 53


TagOn Required. True if the tag is to be set, False if it is to be reset.

Comment Required. A string representing a comment to associate with the tag.

Settings

The Tag parameter can assume any value from 1 to 16. Each value represents a specific bit.
However, only bits 1 (control inhibition) and 16 (information) are currently supported.

Remarks

The method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

This method is deprecated. The use of the TagManager is recommended.

11.1.16 SetTagByName Method


Sets/resets a data point tag based on the point name.

Syntax

Boolean = RTDB.SetTagByName PointName, Tag, TagOn, Comment

The SetTagByName method syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

PointName Required. A string representing the name of the point.

Tag Required. An Integer representing the data point tag to set/reset.

TagOn Required. True if the tag is to be set, False if it is to be reset.

Comment Required. A string representing a comment to associated with the tag.

Settings

The Tag parameter can assume any value from 1 to 16. Each value represents a specific bit.
However, only bits 1 (control inhibition) and 16 (information) are currently supported.

Remarks

The method returns True if it succeeds, False otherwise. Furthermore, it raises an error flag before
returning False.

This method is deprecated. The use of the TagManager is recommended.

54 • Visual T&D Diagram Editor Developer's Reference


11.2 Properties

11.2.1 DataPoints Property


Retrieves a collection of all data points available in the site configuration.

Syntax

DataPoints = RTDB.DataPoints

The DataPoints property syntax has the following part:

Part Description
RTDB Required. A valid RTDB object.

Remarks

The collection returned may be empty if no there are no data points in the site configuration.

11.3 Events
The RTDB object generates events on connection and disconnection.

11.3.1 Connect Event


This event occurs after the RTDB is connected to a Visual T&D Server. The event can be used to
create logical points, which will continue to exist until the Disconnect event occurs.

Syntax

Private Sub RTDB_Connect(ByVal ServerName As String)

The Connect event syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ServerName Required. A string representing the name of the server to which the RTDB is connected.

11.3.2 Disconnect Event


This event occurs after the RTDB is disconnected from a Visual T&D Server.

Visual T&D Diagram Editor Developer's Reference • 55


Syntax

Private Sub RTDB_Disconnect(ByVal ServerName As String)

The Disconnect event syntax has the following parts:

Part Description
RTDB Required. A valid RTDB object.

ServerName Required. A string representing the name of the server from which the RTDB is
disconnected.

56 • Visual T&D Diagram Editor Developer's Reference


12 DataPoints Object

A DataPoints object is a collection of DataPoint objects obtained from the RTDB object. As for
every collection, it can be used in a For … Each construct. It represents the collection of all data
points available in the site configuration.

12.1 Methods
The DataPoints object defines the usual methods for a collection.

12.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid DataPoints object.

itemIndex Required. The index of the data points to get. Only digital values are allowed. The
first data point is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid DataPoint object if itemIndex is valid, otherwise it is Nothing.

12.2 Properties
The DataPoints object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 57


12.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid DataPoints object.

Remarks

The Count property is a read-only property.

58 • Visual T&D Diagram Editor Developer's Reference


13 DataPoint Object

A DataPoint object represents a data point in the site configuration of the Visual T&D Server to
which the Visual T&D Diagram Editor application is connected. A DataPoint object can be used
directly in a For … Each construct to iterate through all the children.

13.1 Properties

13.1.1 FormattedValue Property


Retrieves the formatted engineering value of the data point.

Syntax

object.FormattedValue

The FormattedValue property syntax has the following part:

Part Description
Object Required. A valid DataPoint object.

Remarks

The FormattedValue property is a read-only property.

13.1.2 Id Property
Retrieves the ID of the data point.

Syntax

object.Id

The Id property syntax has the following part:

Visual T&D Diagram Editor Developer's Reference • 59


Part Description
object Required. A valid DataPoint object.

Remarks

The Id property is a read-only property.

13.1.3 Name Property


Retrieves the name of the data point.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid DataPoint object.

Remarks

The Name property is a read-only property.

13.1.4 Quality Property


Retrieves the quality of the data point.

Syntax

object.Quality

The Quality property syntax has the following part:

Part Description
object Required. A valid DataPoint object.

Remarks

The Quality property is a read-only property.

13.1.5 RawValue Property


Retrieves the raw value of the data point.

60 • Visual T&D Diagram Editor Developer's Reference


Syntax

object.RawValue

The RawValue property syntax has the following part:

Part Description
Object Required. A valid DataPoint object.

Remarks

The RawValue property is a read-only property.

13.1.6 Time Property


Retrieves the timestamp of the data point.

Syntax

object.Time

The Time property syntax has the following part:

Part Description
Object Required. A valid DataPoint object.

Remarks

The Time property is a read-only property.

13.1.7 Type Property


Retrieves the type of the data point.

Syntax

object.Type

The Type property syntax has the following part:

Part Description
object Required. A valid DataPoint object.

Settings

The Type property can take any of the following values:

Visual T&D Diagram Editor Developer's Reference • 61


Value Description
POINT_TYPE_ANALOG_INPUT The data point is of analog input type.

POINT_TYPE_ANALOG_OUTPUT The data point is of analog output type.

POINT_TYPE_DIGITAL_INPUT The data point is of digital input type.

POINT_TYPE_DIGITAL_OUTPUT The data point is of digital output type.

Remarks

The Type property is a read-only property.

13.1.8 Value Property


Retrieves the non-formatted engineering value of the data point.

Syntax

object.Value

The Value property syntax has the following part:

Part Description
Object Required. A valid DataPoint object.

Remarks

The Value property is a read-only property.

62 • Visual T&D Diagram Editor Developer's Reference


14 AlarmManager Object

The AlarmManager object represents the Visual T&D Server alarm manager. Every active alarm
is represented and accessible, and can be managed through this object.

An AlarmManager object can be used directly in a For … Each construct to iterate through all
active alarms.

14.1 Methods
The AlarmManager object provides methods for accessing and managing alarms. Any
manipulation on alarms in Visual T&D Diagram Editor is automatically mirrored on the
Visual T&D Server.

14.1.1 Acknowledge Method


Acknowledges an alarm for a specific point.

Syntax

AlarmManager.Acknowledge PointName [, type]

The Acknowledge method syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which to acknowledge the alarm.

type Optional. An ALARM_TYPE enumeration value identifying the alarm type to


acknowledge. If omitted, defaults to ALARM_TYPE_ALL.

Visual T&D Diagram Editor Developer's Reference • 63


Settings

The type parameter can be any of the following:

Value Description
ALARM_TYPE_ALL Any kind of alarm. This value will acknowledge the alarm on the point,
regardless of its type.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes True.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm of the specified type must
exist for the specified point and must not have been acknowledged, and the logged on user must
be able to manage alarms.

14.1.2 AcknowledgeAll Method


Acknowledges all unacknowledged alarms.

Syntax

AlarmManager.AcknowledgeAll

The AcknowledgeAll method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm unacknowledged alarm
must exist and the logged on user must be able to manage alarms.

14.1.3 AcknowledgeOldest Method


Acknowledges the oldest unacknowledged alarm.

Syntax

AlarmManager.AcknowledgeOldest

64 • Visual T&D Diagram Editor Developer's Reference


The AcknowledgeOldest method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails. In order to succeed, an unacknowledged alarm must
exist and the logged on user must be able to manage alarms.

14.1.4 Clear Method


Clears an acknowledged alarm that has returned to normal for a specific point.

Syntax

AlarmManager.Clear PointName [, type]

The Clear method syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which to clear the alarm.

type Optional. An ALARM_TYPE enumeration value identifying the alarm type to clear.
If omitted, defaults to ALARM_TYPE_ALL.

Settings

The type parameter can be any of the following:

Value Description
ALARM_TYPE_ALL Any kind of alarm. This value will clear any alarm on the point, regardless of
its type.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes True.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm of the specified type must
exist for the specified point, must have been acknowledged, must be in the return to normal state,
and the logged on user must be able to manage alarms.

Visual T&D Diagram Editor Developer's Reference • 65


14.1.5 ClearAll Method
Clears all acknowledged alarms that have returned to normal.

Syntax

AlarmManager.ClearAll

The ClearAll method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails. In order to succeed, acknowledged alarms in the return
to normal state must exist and the logged on user must be able to manage alarms.

14.1.6 ClearOldest Method


Clears the oldest acknowledged alarm that has returned to normal.

Syntax

AlarmManager.ClearOldest

The ClearOldest method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails. In order to succeed, an acknowledged alarm in the
return to normal state must exist and the logged on user must be able to manage alarms.

14.1.7 ClearSound Method


Clears the buzzer sound for all clients connected to the server.

Syntax

AlarmManager.ClearSound

The ClearSound method syntax consists of the following part:

66 • Visual T&D Diagram Editor Developer's Reference


Part Description

AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails. For the method to succeed, the logged-on user must be
able to manage alarms.

14.1.8 GetBackGroundColor Method


Returns the configured background color for the specified alarm state and priority.

Syntax

Color = AlarmManager.GetBackGroundColor Priority, State

The GetBackGroundColor method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

Priority Required. Specifies the alarm priority. Valid values are from 1 to 3.

State Required. Specifies the state of the alarm.

Settings

The State parameter can be one of the following:

Value Description
0 Active and unacknowledged alarms.

1 Active and acknowledged alarms.

2 Return to normal and unacknowledged alarms.

3 Return to normal and acknowledged alarms.

Remarks

The background color is returned as Long.

14.1.9 GetDescription Method


Retrieves the description of an alarm.

Visual T&D Diagram Editor Developer's Reference • 67


Syntax

AlarmManager.GetDescription PointName, type

The GetDescription method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which get the description of the alarm.

type Optional. An ALARM_TYPE enumeration value identifying the alarm type for
which to get the description. If omitted, defaults to ALARM_TYPE_ALL.

Settings

The type parameter can be any of the following:

Value Description
ALARM_TYPE_ALL Any kind of alarm. This value will get the description of an
ALARM_BINARY_STATE if the data point is binary; otherwise it will get
the description of an ALARM_LEVEL_LOW for an analog data point.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes true.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails.

14.1.10 GetFlashingState Method


Returns the configured flashing state for the specified alarm state and priority.

Syntax

Flashing = AlarmManager.GetFlashingState Priority, State

The GetFlashingState method syntax consists of the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

Priority Required. Specifies the alarm priority. Valid values are from 1 to 3.

68 • Visual T&D Diagram Editor Developer's Reference


State Required. Specifies the state of the alarm.

Settings

The State parameter can be one of the following:

Value Description
0 Active and unacknowledged alarms.

1 Active and acknowledged alarms.

2 Return to normal and unacknowledged alarms.

3 Return to normal and acknowledged alarms.

Remarks

This method returns a Boolean that indicates whether flashing is configured for the specified alarm
state and priority. The true Boolean state indicates that flashing is configured.

14.1.11 GetPriorityQty Method


Returns the number of supported alarm priority levels.

Syntax

AlarmManager.GetPriorityQty

The GetPriorityQty method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method returns the number of alarm priority levels supported by the system.

14.1.12 GetState Method


Returns the state of the alarms for the specified point.

Syntax

AlarmManager.GetState PointName [, type]

Visual T&D Diagram Editor Developer's Reference • 69


The GetState method syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which the active alarms are to be
verified.

type Optional. An ALARM_TYPE enumeration value identifying the alarm type. If


omitted, defaults to ALARM_TYPE_ALL.

Settings

The type parameter can be one of the following:

Value Description
ALARM_TYPE_ALL Any type of alarm. This value will check for active alarms of any type for the
point.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes True.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm of the specified
type must exist for the specified point.

14.1.13 GetStateQty Method


Returns the number of supported alarm states.

Syntax

AlarmManager.GetStateQty

The GetStateQty method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

This method returns the number of alarm states supported by the system.

70 • Visual T&D Diagram Editor Developer's Reference


14.1.14 GetTextColor Method
Returns the configured text color for the specified alarm state and priority.

Syntax

Color = AlarmManager.GetTextColor Priority, State

The GetTextColor method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

Priority Required. Specifies the alarm priority. Valid values are from 1 to 3.

State Required. Specifies the state of the alarm.

Settings

The State parameter can be one of the following:

Value Description
0 Active and unacknowledged alarms.

1 Active and acknowledged alarms.

2 Return to normal and unacknowledged alarms.

3 Return to normal and acknowledged alarms.

Remarks

The text color is returned as Long.

14.1.15 IsAcknowledged Method


Verifies if an alarm is acknowledged. The alarm must exist.

Syntax

Boolean = AlarmManager.IsAcknowledged PointName, type

The IsAcknowledged method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which to verify the acknowledged
alarm.

Visual T&D Diagram Editor Developer's Reference • 71


type Required. An ALARM_TYPE enumeration value identifying the alarm type. If
omitted, defaults to ALARM_TYPE_ALL.

Settings

The type parameter can be any of the following:

Value Description
ALARM_TYPE_ALL Any kind of alarm. This value will verify for acknowledged alarm of any
type for the point.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes True.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm of the specified type must
exist for the specified point.

14.1.16 IsActive Method


Verifies if alarms are active for a specific point.

Syntax

Boolean = AlarmManager.IsActive PointName [, type]

The IsActive method syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which to verify the active alarms.

type Optional. An ALARM_TYPE enumeration value identifying the alarm type. If


omitted, defaults to ALARM_TYPE_ALL.

Settings

The type parameter can be any of the following:

72 • Visual T&D Diagram Editor Developer's Reference


Value Description
ALARM_TYPE_ALL Any kind of alarm. This value will check for active alarms of any type for the
point.

ALARM_BINARY_STATE Alarm generated when the value of a binary data point becomes True.

ALARM_LEVEL_LOW Alarm generated when the value of an analog data point falls below the lower
threshold.

ALARM_LEVEL_HIGH Alarm generated when the value of an analog data point exceeds the upper
threshold.

ALARM_BAD_QUALITY Alarm generated when the quality of a data point turns bad.

Remarks

This method raises an error flag if it fails. In order to succeed, an alarm of the specified type must
exist for the specified point.

14.1.17 IsDisabled Method


Checks if there is a disabled alarm for the specified data point. An alarm must exist for the data
point.

Syntax

Boolean = AlarmManager.IsDisabled PointName

The IsDisabled method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the data point to be checked for a disabled alarm.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist for the
data point.

14.1.18 IsPermanent Method


Checks if there is a permanent alarm for the specified data point. An alarm must exist for the data
point.

Syntax

Boolean = AlarmManager.IsPermanent PointName

The IsPermanent method syntax consists of the following parts:

Visual T&D Diagram Editor Developer's Reference • 73


Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the data point to be checked for a permanent alarm.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist for the
data point.

14.1.19 IsSilent Method


Check if there is a silent alarm for the specified data point. An alarm must exist for the data point.

Syntax

Boolean = AlarmManager.IsSilent PointName

The IsSilent method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the data point to be checked for a silent alarm.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist for the
data point.

14.1.20 IsSoundDisabled Method


Checks if the buzzer sound is disabled.

Syntax

Boolean = AlarmManager.IsSoundDisabled

The IsSoundDisabled method syntax consists of the following part:

Part Description

AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails.

74 • Visual T&D Diagram Editor Developer's Reference


14.1.21 IsSoundTriggered Method
Checks if the buzzer sound is triggered.

Syntax

Boolean = AlarmManager.IsSoundTriggered

The IsSoundTriggered method syntax consists of the following part:

Part Description

AlarmManager Required. A valid AlarmManager object.

Remarks

This method raises an error flag if it fails.

14.1.22 SetDisabled Method


Sets an alarm to disabled or enabled state.

Syntax

AlarmManager.SetDisabled PointName, bDisabled

The SetDisabled method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which the alarm is to be set to disabled
state.

BDisabled Required. A Boolean: True to disable the alarm, False to enable it.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

14.1.23 SetPermanent Method


Sets an alarm to permanent or non-permanent state.

Syntax

AlarmManager.SetPermanent PointName, bPermanent

The SetPermanent method syntax consists of the following parts:

Visual T&D Diagram Editor Developer's Reference • 75


Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which the alarm is to be set to
permanent state.

bPermanent Required. A Boolean: True to make the alarm permanent, False to make the alarm
non-permanent.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

14.1.24 SetSilent Method


Sets an alarm to silent or audible state.

Syntax

AlarmManager.SetSilent PointName, bSilent

The SetSilent method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

PointName Required. A string identifying the point for which the alarm is to be set to silent
state.

bSilent Required. A Boolean: True to silence the alarm, False to make it audible.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

14.1.25 SetSoundDisabled Method


Sets the buzzer to disabled or enabled state.

Syntax

AlarmManager.SetSoundDisabled bDisable

The SetSoundDisabled method syntax consists of the following parts:

Part Description

AlarmManager Required. A valid AlarmManager object.

76 • Visual T&D Diagram Editor Developer's Reference


Part Description

bDisable Required. A Boolean: True to disable the buzzer, False to enable it.

Remarks

This method raises an error flag if it fails.

14.2 Properties
For the moment, the AlarmManager object has only one property. This property gives access to
the collection of alarms.

14.2.1 Alarms Property


Retrieves a collection of all currently active alarms. An alarm is active if it exists in the alarm
manager. This collection is not dynamic; if new alarms are generated or if existing alarms are
cleared, they will not affect the collection returned.

Syntax

Alarms = AlarmManager.Alarms

The Alarms property syntax has the following part:

Part Description
AlarmManager Required. A valid AlarmManager object.

Remarks

The collection returned may be empty if no alarms are currently active.

14.3 Events
The AlarmManager object generates events on connection, disconnection and changes.

14.3.1 Change Event


This event occurs any time changes occur on alarms on the Visual T&D Server.

Syntax

Private Sub AlarmManager_Change(ByVal Changes As AlarmChanges)

Visual T&D Diagram Editor Developer's Reference • 77


The Change event syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

Changes Required. An AlarmChanges collection of every change that occurred.

14.3.2 Connect Event


This event occurs after the AlarmManager is connected to a Visual T&D Server.

Syntax

Private Sub AlarmManager_Connect(ByVal ServerName As String)

The Connect event syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

ServerName Required. A string representing the name of the server to which the AlarmManager is
connected.

14.3.3 Disconnect Event


This event occurs after the AlarmManager is disconnected from a Visual T&D Server.

Syntax

Private Sub AlarmManager_Disconnect(ByVal ServerName As String)

The Disconnect event syntax has the following parts:

Part Description
AlarmManager Required. A valid AlarmManager object.

ServerName Required. A string representing the name of the server from which the AlarmManager
is disconnected.

78 • Visual T&D Diagram Editor Developer's Reference


15 Alarms Object

An Alarms object represents the collection of active alarms when the collection was obtained. As
for every collections, it can be used in a For … Each construct.

15.1 Methods
Alarms object defines the usual methods for a collection.

15.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Alarms object.

itemIndex Required. The index of the alarm to get. Only numeric values are allowed. The first
alarm is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Alarm object if itemIndex is valid, otherwise it is Nothing.

15.2 Properties
Alarms object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 79


15.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Alarms object.

Remarks

The Count property is a read-only property.

80 • Visual T&D Diagram Editor Developer's Reference


16 Alarm Object

An Alarm object represents an active alarm on the Visual T&D Server. Objects of this type are
accessible through an Alarms collection. All information is accessible through this object and the
alarm can be managed directly.

16.1 Methods
Some methods are provided for managing alarms. They are equivalent to the method of the
AlarmManager object but apply only to the specific alarm.

16.1.1 Acknowledge Method


Acknowledges this alarm.

Syntax

object.Acknowledge

The Acknowledge method syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

This method raises an error flag if the alarm cannot be acknowledged.

16.1.2 Clear Method


Clears this alarm.

Syntax

object.Clear

Visual T&D Diagram Editor Developer's Reference • 81


The Clear method syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

This method raises an error flag if the alarm cannot be cleared.

16.1.3 GetTimeString Method


Return a string containing the date, time and invalid flag (*) of the alarm.

Syntax

Time = object.GetTimeString

The GetTimeString method syntax consists of the following part:

Part Description

object Required. A valid Alarm object.

Remarks

This method returns a String object formatted as “DATE HH:MM:SS.XXX*”, where DATE is in
the Windows long date format, HH are the hours in 2-digit/24-hour format, MM are the minutes,
SS are the seconds, XXX are the milliseconds, and the asterisk is the invalid flag.

16.1.4 SetDisabled Method


Set an alarm to disabled state.

Syntax

object.SetDisabled bDisable

The SetDisabled method syntax consists of the following parts:

Part Description

object Required. A valid Alarm object.

bDisable Required. A Boolean: True to disable the alarm, False to enable it.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

82 • Visual T&D Diagram Editor Developer's Reference


16.1.5 SetPermanent Method
Set an alarm to permanent state.

Syntax

object.SetPermanent bPermanent

The SetPermanent method syntax consists of the following parts:

Part Description

object Required. A valid Alarm object.

bPermanent Required. A Boolean: True to make the alarm permanent, False to make it non-
permanent.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

16.1.6 SetSilent Method


Set an alarm to silent state.

Syntax

object.SetSilent bSilent

The SetSilent method syntax consists of the following parts:

Part Description

object Required. A valid Alarm object.

bSilent Required. A Boolean: True to make the alarm silent, False to make it audible.

Remarks

This method raises an error flag if it fails. For the method to succeed, an alarm must exist and the
logged-on user must be able to manage alarms.

16.2 Properties
In order to access information about the alarm, several properties are defined. Those properties
reflect the state of the alarm when the collection was obtained.

Visual T&D Diagram Editor Developer's Reference • 83


16.2.1 Acknowledged Property
Indicates if the alarm is acknowledged.

Syntax

object.Acknowledged

The Acknowledged property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The Acknowledged property is a read-only property.

16.2.2 Description Property


Retrieves the description of the alarm.

Syntax

object.Description

The Description property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The Description property is a read-only property.

16.2.3 FormattedValue Property


Retrieves a string representing the formatted value, including units, of the associated data point
when the alarm was triggered.

Syntax

object.FormattedValue

The FormattedValue property syntax has the following part:

Part Description
object Required. A valid Alarm object.

84 • Visual T&D Diagram Editor Developer's Reference


Remarks

The FormattedValue property is a read-only property.

16.2.4 IsAcknowledged Property


Indicates whether the alarm is acknowledged.

Syntax

object.IsAcknowledged

The IsAcknowledged property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The IsAcknowledged property is a read-only property.

16.2.5 IsActive Property


Indicate whether the alarm is in active state.

Syntax

object.IsActive

The IsActive property syntax has the following part:

Part Description
Object Required. A valid Alarm object.

Remarks

The IsActive property is a read-only property.

16.2.6 IsDisabled Property


Check the state of the specific alarm to establish if the alarm is disabled.

Syntax

object.IsDisabled

The IsDisabled method syntax consists of the following part:

Visual T&D Diagram Editor Developer's Reference • 85


Part Description

object Required. A valid Alarm object.

Remarks

The IsDisabled property is a read-only property.

16.2.7 IsMultiple Property


Indicate whether the alarm appeared multiple times before being cleared.

Syntax

object.IsMultiple

The IsMultiple property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The IsMultiple property is a read-only property.

16.2.8 IsPermanent Property


Check the state of the specific alarm to establish if the alarm is permanent.

Syntax

object.IsPermanent

The IsPermanent method syntax consists of the following part:

Part Description

Object Required. A valid Alarm object.

Remarks

The IsPermanent property is a read-only property.

16.2.9 IsSilent Property


Check the state of the specific alarm to establish if the alarm is silent.

86 • Visual T&D Diagram Editor Developer's Reference


Syntax

object.IsSilent

The IsSilent method syntax consists of the following part:

Part Description

Object Required. A valid Alarm object.

Remarks

The IsSilent property is a read-only property.

16.2.10 Multiple Property


Indicates if the alarm appeared multiple times before being cleared.

Syntax

object.Multiple

The Multiple property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The Multiple property is a read-only property.

16.2.11 NumericValue Property


Gets the value of the associated data point when the alarm was triggered.

Syntax

object.NumericValue

The NumericValue property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The NumericValue property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 87


16.2.12 Priority Property
Gets the alarm priority level.

Syntax

object.Priority

The Priority property syntax has the following part:

Part Description
Object Required. A valid Alarm object.

Remarks

The Priority property is a read-only property.

16.2.13 Source Property


Retrieves the source of the alarm, that is, the data point name.

Syntax

object.Source

The Source property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The Source property is a read-only property.

16.2.14 Time Property


Retrieves the time of the last operation/change on the alarm.

Syntax

object.Time

The Time property syntax has the following part:

Part Description
object Required. A valid Alarm object.

88 • Visual T&D Diagram Editor Developer's Reference


Remarks

The Time property is a read-only property.

16.2.15 Type Property


Retrieves the type of the alarm.

Syntax

object.Type

The Type property syntax has the following part:

Part Description
object Required. A valid Alarm object.

Remarks

The Type property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 89


17 AlarmChanges Object

An AlarmChanges object is a collection of AlarmChange objects obtained by the Change event


of the AlarmManager object. It represents all the changes that occurred on the Visual T&D
Server for the alarms since the last invocation of the Change event. As for every collection, it can
be used in a For … Each construct.

17.1 Methods
The AlarmChanges object defines the usual methods for a collection.

17.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid AlarmChanges object.

itemIndex Required. The index of the change to get. Only numeric values are allowed. The
first change is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid AlarmChange object if itemIndex is valid, otherwise it is Nothing.

17.2 Properties
The AlarmChanges object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 91


17.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid AlarmChanges object.

Remarks

The Count property is a read-only property.

92 • Visual T&D Diagram Editor Developer's Reference


18 AlarmChange Object

An AlarmChange object represents the changes that occurred on an alarm. It is accessible


through an AlarmChanges collection.

18.1 Properties
The AlarmChange object defines two properties.

18.1.1 Alarm Property


Retrieves the alarm that changed.

Syntax

object.Alarm

The Alarm property syntax has the following part:

Part Description
object Required. A valid AlarmChange object.

Remarks

The property gives access to an Alarm object on which the changes occurred. The Alarm
property is a read-only property.

18.1.2 Change Property


Retrieves the change(s) that occurred on the alarm.

Syntax

object.Change

Visual T&D Diagram Editor Developer's Reference • 93


The Change property syntax has the following part:

Part Description
object Required. A valid AlarmChange object.

Settings

Possible values for this property are any combination of the following:

Value Description
ALARM_CHANGE_CLEARED The alarm was cleared.

ALARM_CHANGE_ADDED This is a new alarm.

ALARM_CHANGE_ACKNOWLEDGED This alarm was acknowledged.

ALARM_CHANGE_STATE The state of the alarm changed.

ALARM_CHANGE_MULTIPLE_APPEARANCE The alarm condition was triggered again when the


alarm was still active.

ALARM_CHANGE_DELETED The alarm was deleted by the system to assure


coherence. This is not the same as
ALARM_CHANGE_CLEARED.

Remarks

The Change property is a read-only property.

94 • Visual T&D Diagram Editor Developer's Reference


19 EventManager Object

The EventManager object represents the Visual T&D Server event manager. The latest events are
represented and accessible, and can be managed through this object.

An EventManager object can be used directly in a For … Each construct to iterate through all
the latest events.

19.1 Properties
The following properties are available for the EventManager object.

19.1.1 Events Property


Retrieves a collection of the latest events that are found on the Visual T&D server. This collection
is not dynamic; if new events are generated, they will not affect the collection returned.

Syntax

Events = EventManager.Events

The Events property syntax has the following part:

Part Description
EventManager Required. A valid EventManager object.

Remarks

The collection returned may be empty if there are no events on the server.

19.1.2 EventTypes Property


Retrieves a collection of all event types that are configured on the server.

Visual T&D Diagram Editor Developer's Reference • 95


Syntax

EventTypes = EventManager.EventTypes

The EventTypes property syntax has the following part:

Part Description
EventManager Required. A valid EventManager object.

19.2 Events
The following EventManager events are generated when the list of events changes on the
Visual T&D Server.

19.2.1 Change Event


This event occurs any time the list of events changes on the Visual T&D Server.

Syntax

Private Sub EventManager_Change(ByVal Changes As EventChanges)

The Change event syntax has the following parts:

Part Description
EventManager Required. A valid EventManager object.

Changes Required. An EventChanges collection of every change that occurred.

96 • Visual T&D Diagram Editor Developer's Reference


20 Events Object

An Events object represents the collection of the latest event when the collection was obtained. As
for every collection, it can be used in a For … Each construct.

20.1 Methods
The following methods are available for an Events object.

20.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Events object.

itemIndex Required. The index of the event to get. Only numeric values are allowed. The first
event is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Event object if itemIndex is valid, otherwise it is Nothing.

20.2 Properties
The following properties are available for an Events object.

Visual T&D Diagram Editor Developer's Reference • 97


20.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Events object.

Remarks

The Count property is a read-only property.

98 • Visual T&D Diagram Editor Developer's Reference


21 EventObject Object

An EventObject object represents an event on the Visual T&D Server. Objects of this type are
accessible through an Events collection. All information is accessible through this object and the
event can be managed directly.

Note: As “Event” is a reserved keyword in Visual Basic, the “Object” suffix was added
to differentiate the Visual T&D event object from the Visual Basic one.

21.1 Methods
The following methods are available for an EventObject object.

21.1.1 IsAlarm Method


Indicates if this event is related to an alarm.

Syntax

object.IsAlarm

The IsAlarm method syntax has the following part:

Part Description
object Required. A valid EventObject object.

21.2 Properties
The following properties are available for an EventObject object.

Visual T&D Diagram Editor Developer's Reference • 99


21.2.1 AlarmState Property
If the event is related to an alarm, retrieves the current state of the alarm.

Syntax

object.AlarmState

The AlarmState property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Returned Value

The AlarmState property can be a combination of the following values:

Value Hex Description


ALARM_NONE 0x00 The event is not related to an alarm.

ALARM_STATE 0x01 The alarm is in its active state, or it has returned to


normal.

ALARM_ACKNOWLEDGED 0x02 The alarm is acknowledged.

ALARM_CLEARED 0x04 The alarm is cleared.

ALARM_RTN_REQUIRED 0x08 Indicates that the alarm must return to its normal
state before being cleared.

ALARM_REAPPEARANCE 0x10 The alarm has reentered its active state at least once
before being acknowledged.

ALARM_DISABLED 0x20 The alarm is blocked.

ALARM_SILENT 0x40 The alarm as been set as silent: it does not activate
a sound warning when triggered.

ALARM_PERMANENT 0x80 The alarm as been set as permanent.

Remarks

The AlarmState property is a read-only property.

21.2.2 Description Property


Retrieves the description of the event.

Syntax

object.Description

100 • Visual T&D Diagram Editor Developer's Reference


The Description property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The Description property is a read-only property.

21.2.3 EventType Property


Retrieves the type of the event.

Syntax

object.EventType

The EventType property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The EventType property is a read-only property.

21.2.4 FormattedValue Property


Retrieves a string representing the formatted value, including units, of the associated data point
when the event was triggered.

Syntax

object.FormattedValue

The FormattedValue property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The FormattedValue property is a read-only property.

21.2.5 Millisecond Property


Retrieves the event timestamp’s milliseconds information.

Visual T&D Diagram Editor Developer's Reference • 101


Syntax

object.Millisecond

The Millisecond property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The Millisecond property is a read-only property.

21.2.6 NumericValue Property


Gets the value of the associated data point when the event was triggered.

Syntax

object.NumericValue

The NumericValue property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The NumericValue property is a read-only property.

21.2.7 Source Property


Retrieves the source of the event, that is, the data point name when involved.

Syntax

object.Source

The Source property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The Source property is a read-only property.

102 • Visual T&D Diagram Editor Developer's Reference


21.2.8 Time Property
Retrieves the timestamp of the event.

Syntax

object.Time

The Time property syntax has the following part:

Part Description
object Required. A valid EventObject object.

Remarks

The Time property is a read-only property.

To obtain the timestamp’s millisecond information, use the Millisecond property.

Visual T&D Diagram Editor Developer's Reference • 103


22 EventTypes Object

An EventTypes object represents the collection of event types when the collection was obtained.
As for every collection, it can be used in a For … Each construct.

22.1 Methods
The following methods are available for an EventTypes object.

22.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid EventTypes object.

itemIndex Required. The index of the event type to get. Only numeric values are allowed. The
first event type is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid EventType object if itemIndex is valid, otherwise it is Nothing.

22.2 Properties
Retrieves the number of objects in the collection.

Visual T&D Diagram Editor Developer's Reference • 105


Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid EventTypes object.

Remarks

The Count property is a read-only property.

106 • Visual T&D Diagram Editor Developer's Reference


23 EventType Object

An EventType object is accessible through the EventType member of an EventObject object or


an EventTypes collection. This object contains information about a type of event as in the
Visual T&D Server configuration.

23.1 Properties
The following properties are available for the EventType object.

23.1.1 Name Property


Retrieves the name of the event type.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid EventType object.

Remarks

The Name property is a read-only property.

23.1.2 SubTypeId Property


Retrieves the event’s subtype identifier, if the event is a process-related event or a tag operation
event.

Syntax

object.SubTypeId

Visual T&D Diagram Editor Developer's Reference • 107


The SubTypeId property syntax has the following part:

Part Description
object Required. A valid EventType object.

Remarks

The SubTypeId property is a read-only property.

23.1.3 TypeId Property


Retrieves the event type identifier.

Syntax

object.TypeId

The TypeId property syntax has the following part:

Part Description
object Required. A valid EventType object.

Remarks

The TypeId property is a read-only property.

108 • Visual T&D Diagram Editor Developer's Reference


24 EventChanges

An EventChanges object is a collection of EventChange objects obtained by the Change event


of the EventManager object. It represents all the changes that occurred on the event list of the
Visual T&D Server since the last invocation of the Change event. As for every collection, it can
be used in a For … Each construct.

24.1 Methods
The following methods are available for the EventChanges object.

24.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid EventChanges object.

itemIndex Required. The index of the change to get. Only numeric values are allowed. The
first change is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid EventChange object if itemIndex is valid, otherwise it is Nothing.

24.2 Properties
The following properties are available for the EventChanges object.

Visual T&D Diagram Editor Developer's Reference • 109


24.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid EventChanges object.

Remarks

The Count property is a read-only property.

110 • Visual T&D Diagram Editor Developer's Reference


25 EventChange

An EventChange object represents the changes that occurred on an event. It is accessible through
an EventChanges collection.

25.1 Properties
The following properties are available for the EventChange object.

25.1.1 Change Property


Retrieves the change(s) that occurred on the event.

Syntax

object.Change

The Change property syntax has the following part:

Part Description
object Required. A valid EventChange object.

Returned Value

Possible values for this property are any combination of the following:

Value Description
EVENT_CHANGE_ADDED This is a new event.

Remarks

The Change property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 111


25.1.2 EventObject Property
Retrieves the event that changed.

Syntax

object.EventObject

The Alarm property syntax has the following part:

Part Description
object Required. A valid EventChange object.

Remarks

The property gives access to an EventObject object on which the changes occurred. The
EventObject property is a read-only property.

112 • Visual T&D Diagram Editor Developer's Reference


26 TagManager Object

The TagManager object represents the tag manager of the Visual T&D Server. Every active tag is
represented, accessible and can be managed through this object.

A TagManager object can be used directly in a For … Each construct, to iterate through all
active tags.

26.1 Methods
Several methods are provided to manage tags on the Visual T&D Server.

26.1.1 Add Method


Adds a tag for the specified data point.

Syntax

TagManager.Add pointName, tagTypeId, object[, Comment]

The Add method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

pointName Required. The point name associated to the tag. It must not be empty.

tagTypeId Required. An index value identifying the tag type. The type must exist in the
configuration.

Note: Old TAG_TYPE enumeration values are still supported.

object Required. A string identifying the data point.

Comment Optional. A string used as a comment for the tag. The content of the string can be
anything and is not limited. It can be empty. If omitted, an empty string is used.

Visual T&D Diagram Editor Developer's Reference • 113


Remarks

This method raises an error flag if it fails.

26.1.2 Clear Method


Clears the specified tags.

Syntax

TagManager.Clear range[, tagTypeId[, label]]

The Clear method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

range Required. A TAG_RANGE enumeration value identifying which tag(s) to clear.


This value will determine how the following parameters are interpreted.

tagTypeId Optional. An index value identifying on which type of tag the clear operation should
be performed. Ignored if range is TAG_RANGE_BY_ID. If omitted, defaults to 0
(which represents all tag types).

Note: Old TAG_TYPE enumeration values are still supported.

label Optional. Interpretation depends on range:

‰ If range is TAG_RANGE_BY_ID, the name of the tag to clear.


‰ If range is TAG_RANGE_BY_OBJECT, the name of the data point for which
tags should be cleared.
‰ If range is TAG_RANGE_BY_OWNER, the name of the owner of the tags that
should be cleared.
‰ If TAG_RANGE_ALL, ignored.
‰ If omitted, defaults to an empty string.

Settings

The range parameter can assume the following values:

Value Description
TAG_RANGE_BY_ID The label parameter identifies a specific tag by its identifier.

TAG_RANGE_BY_OBJECT The label parameter identifies a specific object (i.e., a data


point). The operation is to be performed on each tag of this
object belonging to the current user (or to all users if the
current user has the privilege to manage tags added by other
users.)

114 • Visual T&D Diagram Editor Developer's Reference


Value Description
TAG_RANGE_BY_OWNER The label parameter identifies a user. The operation is to be
performed on each tag belonging to this user. If this user is
not the current one, it must have the User can manage tags
added by other users privilege to successfully complete this
operation.

TAG_RANGE_ALL The label parameter is ignored. The operation is to be


performed on all tags belonging to this user (or to all users if
the current user has the User can manage tags added by other
users privilege.)

Remarks

This method raises an error flag if it fails. A user cannot clear tags belonging to another user
unless he has the right to edit the site configuration.

26.1.3 Edit Method


Edits the comment of a specific tag.

Syntax

TagManager.Edit pointName, Comment

The Edit method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

pointName Required. The point name associated to the tag for which a comment is to be edited.

Comment Required. A string used as the new comment for the tag. The content of the string
can be anything and is not limited. It can be empty.

Remarks

This method raises an error flag if it fails.

26.1.4 Get Method


Retrieves the specified tags.

Syntax

Tags = TagManager.Get range[, tagTypeId[, label]]

Visual T&D Diagram Editor Developer's Reference • 115


The Get method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

range Required. A TAG_RANGE enumeration value identifying which tag(s) to get. This
value will determine how the following parameters are interpreted.

tagTypeId Optional. An index value identifying which tag type to get. Ignored if range is
TAG_RANGE_BY_ID. If omitted, defaults to 0 (which represents all tag types).

Note: Old TAG_TYPE enumeration values are still supported.

label Optional. Interpretation depends on range:

‰ If range is TAG_RANGE_BY_ID, the name of the tag to get.


‰ If range is TAG_RANGE_BY_OBJECT, the name of the data point for which
tags should be returned.
‰ If range is TAG_RANGE_BY_OWNER, the name of the owner of the tags that
should be returned.
‰ If TAG_RANGE_ALL, ignored.
‰ If omitted, defaults to an empty string.

Settings

The range parameter can assume the following values:

Value Description
TAG_RANGE_ALL The label is ignored. Retrieves all the tags.

TAG_RANGE_BY_ID The label parameter identifies a specific tag by its identifier.


Retrieves only this tag.

TAG_RANGE_BY_OBJECT The label parameter identifies a specific object (that is, a data
point). Retrieves all tags on this object.

TAG_RANGE_BY_OWNER The label parameter identifies a user. The operation is to be


performed on each tag belonging to this user.

Remarks

This method raises an error flag if it fails. The returned collection may be empty if no tags match
the search criteria specified.

26.1.5 GetCount Method


Get a count of active tags (any type or specific type) on a data point.

116 • Visual T&D Diagram Editor Developer's Reference


Syntax

TagCount = TagManager.GetCount pointName[, tagTypeId]

The GetCount method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

pointName Required. The point name associated to the tag for which to count the active tags.

tagTypeId Optional. An index value identifying which tag type to count. The type must exist in
the configuration. If omitted, defaults to 0. (which represents all tag types)

Remarks

This method raises an error flag if it fails. If no tags are found, it returns 0.

26.1.6 GetNextSerialNumber Method


Return a serial number.

Syntax

nextSerialNo = TagManager.GetNextSerialNumber generatorId

The GetNextSerialNumber method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

generatorId Required. The numeric identifier of a number generator

Remarks

The generatorId parameter can be use to maintain multiple sequences of numbers. Consider a
category X and a category Y. The first call of GetNextSerialNumber(X) on a system will return 1,
the second one will return 2, etc… You can then call GetNextSerialNumber(Y) to obtain a fresh
sequence starting at number one. There’s no need to initially create a generator.

Sequences are not reset when the application or the workstation restarts: to reset a sequence, you
must use the ResetSerialNumber method.

26.1.7 GetTypeInfo Method


Retrieves information about tag types.

Visual T&D Diagram Editor Developer's Reference • 117


Syntax

TagTypes = TagManager.GetTypeInfo [tagTypeId]

The GetTypeInfo method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

tagTypeId Required. An index value identifying which tag type to get information for. The
type must exist in the configuration. If omitted, defaults to 0. (which represents all
tag types)

Note: Old TAG_TYPE enumeration values are still supported.

Remarks

This method raises an error flag if it fails. The collection returned may be empty.

26.1.8 ResetSerialNumber Method


Resets the sequence of a serial number generator.

Syntax

TagManager.ResetSerialNumber generatorId

The ResetSerialNumber method syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

generatorId Required. The identifier of a serial number generator

Remarks

Calling ResetSerialNumber(X) will make the next call to GetNextSerialNumber(X) return “1”.

26.2 Properties
The TagManager object defines some properties that give access to the collections of objects
managed by the Visual T&D Server.

26.2.1 Tags Property


Retrieves the collection of tags.

118 • Visual T&D Diagram Editor Developer's Reference


Syntax

TagManager.Tags

The Tags property syntax has the following part:

Part Description
TagManager Required. A valid TagManager object.

Remarks

The collection returned may be empty. The Tags property is a read-only property.

26.2.2 Types Property


Retrieves the collection of tag types.

Syntax

TagTypes = TagManager.Types

The Types property syntax has the following part:

Part Description
TagManager Required. A valid TagManager object.

Remarks

The Types property is a read-only property.

26.3 Events
The AlarmManager object generates events on connection, disconnection and changes.

26.3.1 Change Event


This event occurs any time changes occur on tags on the Visual T&D Server.

Syntax

Private Sub TagManager_Change(ByVal Changes As TagChanges)

Visual T&D Diagram Editor Developer's Reference • 119


The Change event syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

Changes Required. A TagChanges collection of every change that occurred.

26.3.2 Connect Event


This event occurs after the TagManager is connected to a Visual T&D Server.

Syntax

Private Sub TagManager_Connect(ByVal ServerName As String)

The Connect event syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

ServerName Required. A string representing the name of the server to which the TagManager is
connected.

26.3.3 Disconnect Event


This event occurs after the TagManager is disconnected from a Visual T&D Server.

Syntax

Private Sub TagManager_Disconnect(ByVal ServerName As String)

The Disconnect event syntax has the following parts:

Part Description
TagManager Required. A valid TagManager object.

ServerName Required. A string representing the name of the server from which the TagManager is
disconnected.

120 • Visual T&D Diagram Editor Developer's Reference


27 Tags Object

A Tags object represents the collection of active tags when the collection was obtained. As for
every collection, it can be used in a For … Each construct.

27.1 Methods
Tags object defines the usual methods for a collection.

27.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Alarms object.

itemIndex Required. The index of the tag to get. Only numeric values are allowed. The first tag
is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid Tag object if itemIndex is valid, otherwise it is Nothing.

27.2 Properties
Tags object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 121


27.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid Tags object.

Remarks

The Count property is a read-only property.

122 • Visual T&D Diagram Editor Developer's Reference


28 Tag Object

This object represents a tag as in the Visual T&D Server.

28.1 Methods
A Tag object defines one method in order to clear it from the Visual T&D Server.

28.1.1 Clear Method


Clears the tag on the Visual T&D Server.

Syntax

object.Clear

The Clear method syntax has the following part:

Part Description
object Required. A valid Tag object.

Remarks

This method raises an error flag if it fails. The rules for clearing a tag are the same as the Clear
method of the TagManager object.

28.2 Properties
Several properties exist on a Tag object. Those properties can be used to get more information
about a specific tag.

28.2.1 Comment Property


Retrieves/sets the comment associated with the tag.

Visual T&D Diagram Editor Developer's Reference • 123


Syntax

object.Comment [= String]

The Comment property syntax has the following part:

Part Description
object Required. A valid Tag object.

Remark

This property may raise en error flag if the comment cannot be set.

28.2.2 Id Property
Retrieves the identifier of the tag.

Syntax

object.Id

The Id property syntax has the following part:

Part Description
object Required. A valid Tag object.

Remarks

The Id property is a read-only property.

28.2.3 object Property


Retrieves the object associated with the tag. This is usually the data point name.

Syntax

object.object

The object property syntax has the following part:

Part Description
object Required. A valid Tag object.

Remarks

The object property is a read-only property.

124 • Visual T&D Diagram Editor Developer's Reference


28.2.4 Owner Property
Retrieves the owner of the tag. This is usually the login name of the user who added the tag.

Syntax

object.Owner

The Owner property syntax has the following part:

Part Description
object Required. A valid Tag object.

Remarks

The Owner property is a read-only property.

28.2.5 Time Property


Time the tag was created.

Syntax

object.Time

The Time property syntax has the following part:

Part Description
object Required. A valid Tag object.

Remarks

The Time property is a read-only property. See Obtaining Milliseconds from a Date Object, for a
code snippet of how to obtain the milliseconds.

28.2.6 Type Property


Retrieves a TagType object containing information about the tag type.

Syntax

object.Type

The Type property syntax has this part:

Part Description
object Required. A valid Tag object.

Visual T&D Diagram Editor Developer's Reference • 125


Remarks

The Type property is a read-only property.

126 • Visual T&D Diagram Editor Developer's Reference


29 TagTypes Object

A TagTypes object represents the collection of tag types when the collection was obtained. As for
every collection, it can be used in a For … Each construct.

29.1 Methods
TagTypes object defines the usual methods for a collection.

29.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid Alarms object.

itemIndex Required. The index of the tag type to get. Only numeric values are allowed. The
first tag type is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid TagType object if itemIndex is valid, otherwise it is Nothing.

29.2 Properties
The TagTypes object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 127


29.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid TagTypes object.

Remarks

The Count property is a read-only property.

128 • Visual T&D Diagram Editor Developer's Reference


30 TagType Object

A TagType object is accessible through the Type member of a Tag object or a TagTypes
collection. This object contains information about a type of tag as in the Visual T&D Server
configuration.

30.1 Properties
The properties of a TagType object provide access to information about the tag type as configured
in the Visual T&D Server.

30.1.1 Action Property


Retrieves the action associated with this type.

Syntax

object.Action

The Action property syntax has the following part:

Part Description
object Required. A valid TagType object.

Settings

The property may take any of the following values:

Value Description
TAG_TYPE_ALL_CONTROL_INHIBITED Represents a control inhibition tag.

TAG_TYPE_INFORMATION Represents an information tag.

Remarks

The Action property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 129


30.1.2 Color Property
Retrieves the color for this kind of tag.

Syntax

object.Color

The Color property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The Color property is a read-only property.

30.1.3 Description Property


Retrieves the description of the tag type.

Syntax

object.description

The description property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The description property is a read-only property.

30.1.4 Group Property


Retrieves the group identifier of this tag type.

Syntax

object.Group

The Group property syntax has the following part:

Part Description
object Required. A valid TagType object.

130 • Visual T&D Diagram Editor Developer's Reference


Remarks

The Group property is a read-only property.

30.1.5 Maximum Property


Retrieves the maximum number of tag instances of this type a data point can have.

Syntax

object.Maximum

The Maximum property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The Maximum property is a read-only property.

30.1.6 Name Property


Retrieves the name of the tag type.

Syntax

object.Name

The Name property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The Name property is a read-only property.

30.1.7 Priority Property


Retrieves the priority of this tag type. The lowest number represents the highest priority tag.

Syntax

object.Priority

The Priority property syntax has the following part:

Visual T&D Diagram Editor Developer's Reference • 131


Part Description
object Required. A valid TagType object.

Remarks

The Priority property is a read-only property.

30.1.8 Symbol Property


Retrieves the symbol for this tag type. The symbol is a string.

Syntax

object.Symbol

The Symbol property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The Symbol property is a read-only property.

30.1.9 TagTypeId Property


Retrieves the tag type identifier.

Syntax

object.TagTypeId

The TagTypeId property syntax has the following part:

Part Description
object Required. A valid TagType object.

Remarks

The TagTypeId property is a read-only property.

30.1.10 Type Property


Retrieves the action associated with this type. (For backward compatibility)

132 • Visual T&D Diagram Editor Developer's Reference


Syntax

object.Type

The Type property syntax has the following part:

Part Description
object Required. A valid TagType object.

Settings

The property may take any of the following values:

Value Description
TAG_TYPE_ALL_CONTROL_INHIBITED Represents a control inhibition tag.

TAG_TYPE_INFORMATION Represents an information tag.

Remarks

The Type property is a read-only property.

Visual T&D Diagram Editor Developer's Reference • 133


31 TagChanges Object

A TagChanges object is a collection of TagChange objects obtained by the Change event of the
TagManager object. It represents all the changes that occurred on the Visual T&D Server for the
tags since the last invocation of the Change event. As for every collection, it can be used in a For
… Each construct.

31.1 Methods
The TagChanges object defines the usual methods for a collection.

31.1.1 Item Method


Gives access to a specific item in the collection.

Syntax

Object = object.Item itemIndex

The Item method syntax has the following parts:

Part Description
object Required. A valid TagChanges object.

itemIndex Required. The index of the change to get. Only numeric values are allowed. The
first change is at index 0, the second, at index 1, etc.

Remarks

The returned value is a valid TagChange object if itemIndex is valid, otherwise it is Nothing.

31.2 Properties
The TagChanges object defines the usual properties for a collection.

Visual T&D Diagram Editor Developer's Reference • 135


31.2.1 Count Property
Retrieves the number of objects in the collection.

Syntax

object.Count

The Count property syntax has the following parts:

Part Description
object Required. A valid TagChanges object.

Remarks

The Count property is a read-only property.

136 • Visual T&D Diagram Editor Developer's Reference


32 TagChange Object

A TagChange object represents the changes that occurred on a tag. It is accessible through a
TagChanges collection.

32.1 Properties
The TagChange object defines two properties.

32.1.1 Tag Property


Retrieves the tag that changed.

Syntax

object.Tag

The Tag property syntax has the following part:

Part Description
object Required. A valid TagChange object.

Remarks

The property gives access to a Tag object for which the changes occurred. The Tag property is a
read-only property.

32.1.2 Change Property


Retrieve the change that occurred on the tag.

Syntax

object.Change

Visual T&D Diagram Editor Developer's Reference • 137


The Change property syntax has the following part:

Part Description
object Required. A valid TagChange object.

Settings

Possible values for this property are:

Value Description
TAG_CHANGE_ADDED This is a new tag.

TAG_CHANGE_MODIFIED The tag was modified. As for now, it means the comment
associated with the tag was modified.

TAG_CHANGE_DELETED This tag was cleared.

Remarks

The Change property is a read-only property.

138 • Visual T&D Diagram Editor Developer's Reference


33 The VBA Project

For each diagram you create, there is an associated VBA project.

A VBA project consists of modules, class modules and user forms.

‰ A module consists of a set of declarations followed by procedures – scripts of instructions that


a program can perform.

‰ A class module defines objects, their properties, and their methods. A class module acts as a
template from which an instance of an object is created at run time. Every diagram project
contains the Application, Document, Shape and RTDB class modules.

‰ A user form contains user interface controls, such as command buttons and text boxes.

Once you have created the graphic aspects of your diagram, you will design your VBA project.
Typically, you will create a new module for each major component of your diagram. In each
module, you will create the procedures necessary to process the events that occur in the diagram.
If you plan your modules carefully, you will be able to export diagram pages and shapes to library
files.

33.1 Adding a Module to the Project


To add a new module to your VBA project using the Visual Basic Editor:

‰ Select the Module command in the Insert menu of the Visual Basic Editor.

‰ Select the Name property in the Properties window and enter a meaningful name for your
module.

Tip: You should always begin your modules with the Option Explicit statement. This
statement ensures that all Visual Basic variables are declared before they are
used.

Visual T&D Diagram Editor Developer's Reference • 139


33.2 Adding a Procedure to a Module
To add a new procedure to your VBA project using the Visual Basic Editor:

‰ Select the module in the VBA project window.

‰ Select the Code command in the View menu.

‰ Select the Procedure command in the Insert menu of the Visual Basic Editor.

‰ Enter a name for the procedure, select the type and scope.

Tip: Because of the specific parameters required, it is easier to use the Visual Basic
Wizard to create event handlers.

33.3 Adding a Form to the Project


You can use the VBA development environment to create user forms that contain standard
Windows controls and fields that the program operators can use to control functions, and display
and enter values.

To add a user form to your project:

‰ Select the UserForm command in the Insert menu of the Visual Basic Editor.

‰ Select the Name property in the Properties window and enter a meaningful name for the form.
This name will be used as a prefix for all the form event handlers.

‰ Select the Caption property in the Properties window and enter a meaningful caption for the
form.

When you add a user form to your project, VBA automatically opens the Controls Toolbox. This
toolbox contains controls that you can place on the form. Each control has its own properties and
generates events for which you can provide event handlers.

140 • Visual T&D Diagram Editor Developer's Reference


34 Programming Techniques

In this section, we will explain basic programming techniques that you can use to add
sophisticated capabilities to your diagrams.

34.1 Resolving Aliases


If you want to reuse shapes and diagram pages, you will need to remove all dependencies to
physical data points. If you identify data points by using aliases, Diagram Editor can automatically
replace these by the tag names of the data points.

Diagram Editor generates a Resolve Alias event before it displays a new diagram page. To
automatically assign tag names to aliases, you must provide a Visual Basic procedure that is
associated with the Resolve Alias event of each shape.

In order to automatically assign aliases to variables, you will need to use a naming convention.
The following table illustrates a simple convention you can use, where the name of each shape
corresponds to a device and the name of each alias corresponds to a type of data. The variable
names are composed of the device name and the data point name, separated by an underscore.

Shape Alias Variable / Data Point Tag


HWD_T3_P632 CB_Open HWD_T3_P632_ CB_Open

HWD_T3_P632 Close HWD_T3_P632_Close

HWD_T3_D MS_Open HWD_T3_D_MS_Open

HWD_EAST_SAGE_49L Control HWD_EAST_SAGE_49L_Control

The following sample procedure illustrates how you can implement a procedure that assigns
aliases to variables according to the above naming convention.

Public Function ResolveAlias(DiagramShape As Shape)


Dim alias As String
Dim variable As String
Dim shapename As String
Dim aliasCount As Long

Visual T&D Diagram Editor Developer's Reference • 141


Dim index As Long

shapename = DiagramShape.Name
aliasCount = DiagramShape.aliasCount
For index = 1 To aliasCount Step 1
DiagramShape.GetAlias index, alias
variable = shapename + "_" + alias
DiagramShape.ResolveAlias index, variable
Next index

End Function

Note: You can use a single procedure to resolve the aliases for all the shapes in your
diagram. However, you will have to assign the procedure individually to each
shape.

34.2 Handling Mouse Events


When you use the mouse click on a shape, the Diagram Editor generates a Click event. For each
shape in the diagram, you can provide a procedure that processes the event in the manner most
appropriate for your site.

In the following sample code, a click on a shape displays a message box where the operator
confirms an operation. If the operator confirms, the procedure invokes another procedure to handle
the operation.

Public Function OnClick(DiagramShape As Shape, _


X As Long, Y As Long, _
VirtKeyCode As VIRTUAL_KEY_CODE, _
MouseButton As MOUSE_BUTTON)
Dim confirm As Integer
Dim question As String
question = "Activate " + DiagramShape.Name + "?"
confirm = MsgBox(question, vbYesNo)
If confirm = vbYes Then
ActivateDevice DiagramShape
End If
End Function

34.3 Displaying Diagram Pages


When you run your diagram in animation mode, it displays the background page. You will have to
use a Visual Basic procedure to display the other pages.

In the following sample code, we use the Click event handler to display a diagram page:

142 • Visual T&D Diagram Editor Developer's Reference


Public Function OpenMeter(DiagramShape As Shape, _
X As Long, Y As Long, _
VirtKeyCode As VIRTUAL_KEY_CODE, _
MouseButton As MOUSE_BUTTON)
Document.OpenPage "MeterPanel", 100, _
120, 120, 650, 700, _
DiagramShape.Name
End Function

The OpenPage method uses the name of the selected shape to select a shape renaming table.

34.4 Accessing Data Points


The VBA environment includes objects that represent the major elements of the diagram
application. One of these elements, the RTDB, represents Visual T&D server database. You will
use the methods of this object to access the data points.

In the following sample code, we use the Click event handler to toggle the tag associated with a
device:

Public Function ToggleTag(DiagramShape As Shape, _


X As Long, Y As Long, _
VirtKeyCode As VIRTUAL_KEY_CODE, _
MouseButton As MOUSE_BUTTON)
Dim PointName As String
Dim TagValue As Boolean

' Build tagname from shape name and data point name
PointName = DiagramShape.Name + "_CB_Open"

' Get current value of tag and offer to toggle


RTDB.GetTagByName PointName, 1, TagValue
If TagValue = True Then
If vbOK = MsgBox("Untag the device?", vbOKCancel) Then
RTDB.SetTagByName PointName, 1, False, ""
End If
Else
If vbOK = MsgBox("Tag the device?", vbOKCancel) Then
RTDB.SetTagByName PointName, 1, True, ""
End If
End If
End Function

34.5 Displaying User Forms


Your Visual Basic procedure can display user forms that contain fields and controls that you can
use to display values or control operations.

The following code processes the Click event and displays a user form called "BreakerForm":

Visual T&D Diagram Editor Developer's Reference • 143


' Store a reference to shape that was clicked
Public CurrentDiagramShape As Shape

' Handle Click on device


Public Function BreakerShow(DiagramShape As Shape, _
X As Long, Y As Long, _
VirtKeyCode As VIRTUAL_KEY_CODE, _
MouseButton As MOUSE_BUTTON)

' Store reference to shape that was clicked


Set CurrentDiagramShape = DiagramShape
' Display user form with correct caption
BreakerForm.Caption = DiagramShape.Name
BreakerForm.Show
End Function

34.6 Controlling Devices


Typically, there are two ways you can control a device. In the first case, the device is directly
controlled by Open and Close signals. To control such a device, you simply activate the
corresponding data points. In the other case, you must first select the device to be operated. If this
succeeds, you can then send an Open or Close command.

The Visual T&D server implements both methods of operation.

34.6.1 Direct Execution Commands


In the following sample, we implement a user form that controls a circuit breaker. The form is
called "BreakerForm" and contains two button controls. The user selects the operation to be
performed by clicking on either the Trip or the Close button.

' Contains a copy of the selected shape


Public CurrentDiagramShape As Shape

' Process click on Trip button


Private Sub TripButton_Click()
Dim name As String
Dim status As Long

144 • Visual T&D Diagram Editor Developer's Reference


' Get tagname used to open device and send command
CurrentDiagramShape.GetVariableFromAlias "Trip", name
RTDB.SendBinaryCmnd name, CMND_TYPE_DIRECT_EXECUTE, _
EXEC_TYPE_PULSE, pStatus, 100, 5000
If status >= &H1000& Then
MsgBox "Error opening " name + " " + Str(status)
End If
BreakerForm.Hide
Unload Me
End Sub

' Process click on Close button


Private Sub CloseButton_Click()
Dim name As String
Dim status As Long

CurrentDiagramShape.GetVariableFromAlias "Close", name


RTDB.SendBinaryCmnd name, CMND_TYPE_DIRECT_EXECUTE, _
EXEC_TYPE_PULSE, pStatus, 100, 5000
If pStatus >= &H1000& Then
MsgBox "Error opening " name + " " + Str(status)
End If
BreakerForm.Hide
Unload Me
End Sub

34.6.2 Select and Execute Commands


In the following sample, we implement a user form that controls a circuit breaker. The form is
named "BreakerForm" and contains three button controls. The user selects the operation to be
performed by clicking on either the Trip or the Close button, and then clicks Execute.

' Contains a copy of the selected shape


Public CurrentDiagramShape As Shape
' Tagname used to control device
Dim SelectedPoint As String
' EXEC_TYPE_OPEN or EXEC_TYPE_CLOSE
Dim SelectedOperation As Long

Visual T&D Diagram Editor Developer's Reference • 145


' Setup user form
Private Sub UserForm_Initialize()
SelectedPoint = ""
SelectedOperation = -1 ' no operation selected
ExecuteButton.Enabled = False ' cannot execute
End Sub

' Process click on Close button


Private Sub CloseButton_Click()
Dim CloseName As String
Dim status As Long

' Get tagname used to operate device and select


' The alias is named "Control"
CurrentDiagramShape.GetVariableFromAlias "Control", CloseName
RTDB.SendBinaryCmnd CloseName, CMND_TYPE_SELECT, _
EXEC_TYPE_CLOSE, status, 1000, 5000
' Status is OK if less than 1000 hex.
If (status < &H1000&) Then
SelectedPoint = CloseName
SelectedOperation = EXEC_TYPE_CLOSE
ExecuteButton.Enabled = True
Else
RTDB.GetCmndStatusString status, CloseName
MsgBox "Error Selecting output: " + CloseName
End If
End Sub

' Process click on Trip button


Private Sub TripButton_Click()
Dim TripName As String
Dim status As Long

' Get tagname used to operate device and select


CurrentDiagramShape.GetVariableFromAlias "Control", TripName
RTDB.SendBinaryCmnd TripName, CMND_TYPE_SELECT, _
EXEC_TYPE_OPEN, status, 1000, 5000
' Status is OK if less than 1000 hex.
If (status < &H1000&) Then
SelectedPoint = TripName
SelectedOperation = EXEC_TYPE_OPEN
ExecuteButton.Enabled = True
Else
RTDB.GetCmndStatusString status, TripName
MsgBox "Error Selecting output: " + TripName
End If
End Sub

' Process click on Execute button


Private Sub ExecuteButton_Click()
Dim status As Long

146 • Visual T&D Diagram Editor Developer's Reference


RTDB.SendBinaryCmnd SelectedPoint, CMND_TYPE_EXECUTE, _
SelectedOperation, pStatus, 1000, 5000
' Status is ok if less than 1000 hex.
If (status < &H1000&) Then
MsgBox "Error executing: " + Str(status)
End If
ExecuteButton.Enabled = False
BreakerForm.Hide
Unload Me
End Sub

34.7 Obtaining Milliseconds from a Date Object


The following code can be used to extract, from a Date object, the milliseconds. A Date object is
used when a date or time is needed.

' Extracts, from a Date object, the milliseconds value


' This information cannot be accessed explicitly but is present
Private Function Millis(ByVal moment As Date) As Long
Dim number As Double ' Working data
Dim second As Long ' Number of second

' Pass from Date object to double value


number = CDbl(moment)
' Only keeps fractional part, which is the time of the day
number = number - Fix(number)
' Calculates number of second elapsed in day
second = Fix(number * 24 * 60 * 60)
' Milliseconds value (number of milliseconds in day –
' number of milliseconds in complete seconds)
Millis = CLng(number * 24 * 60 * 60 * 1000) - second * 1000
End Function

Visual T&D Diagram Editor Developer's Reference • 147

You might also like