Proficy* HMI/SCADA - iFIX
IFIX AUTOMATION
REFERENCE (EVENTS,
SUBROUTINES, FUNCTIONS,
AND EXAMPLES)
VERSION 5.1
May 2010
All rights reserved. No part of this publication may be
reproduced in any form or by any electronic or mechanical
means, including photocopying and recording, without
permission in writing from GE Intelligent Platforms, Inc.
Disclaimer of Warranties and Liability
The information contained in this manual is believed to be
accurate and reliable. However, GE Intelligent Platforms,
Inc. assumes no responsibilities for any errors, omissions or
inaccuracies whatsoever. Without limiting the foregoing,
GE Intelligent Platforms, Inc. disclaims any and all
warranties, expressed or implied, including the warranty of
merchantability and fitness for a particular purpose, with
respect to the information contained in this manual and the
equipment or software described herein. The entire risk as
to the quality and performance of such information,
equipment and software, is upon the buyer or user. GE
Intelligent Platforms, Inc. shall not be liable for any
damages, including special or consequential damages,
arising out of the user of such information, equipment and
software, even if GE Intelligent Platforms, Inc. has been
advised in advance of the possibility of such damages. The
user of the information contained in the manual and the
software described herein is subject to the GE Intelligent
Platforms, Inc. standard license agreement, which must be
executed by the buyer or user before the use of such
information, equipment or software.
Notice
©2010 GE Intelligent Platforms, Inc. All rights reserved.
*Trademark of GE Intelligent Platforms, Inc.
Microsoft® is a registered trademark of Microsoft
Corporation, in the United States and/or other countries.
All other brands or names are property of their respective
holders.
We want to hear from you. If you have comments,
questions, or suggestions about our documentation, send
them to the following email address:
doc@[Link]
Table of Contents
About this Guide .......................................... 57
Events ......................................................... 58
A-D .............................................................. 58
Activated Event .......................................... 58
Syntax .................................................. 58
Properties ............................................. 58
AfterKillFocus Event ................................... 59
Syntax .................................................. 59
Properties ............................................. 59
AlarmAck Event .......................................... 60
Syntax .................................................. 60
Properties ............................................. 60
AlarmAcknowledged Event ......................... 61
Syntax .................................................. 61
Properties ............................................. 62
Remarks ............................................... 63
AlarmListChanged Event ............................ 63
Syntax .................................................. 63
Properties ............................................. 63
Remarks ............................................... 64
Click Event ................................................. 65
Syntax .................................................. 65
Properties ............................................. 65
Remarks ............................................... 66
Close Event ................................................ 66
Syntax .................................................. 67
Properties ............................................. 67
ColorChanged Event .................................. 67
Syntax .................................................. 67
Properties ............................................. 68
DataChange Event ..................................... 68
Syntax .................................................. 69
Properties ............................................. 69
Event Firing Definition .......................... 71
Using the DataChange Event in a
Datalink ................................................ 72
To create your own object: ................... 72
DblClick Event ............................................ 73
Syntax .................................................. 73
Properties ............................................. 73
Remarks ............................................... 74
Alarm Summary Syntax ........................ 74
Properties ............................................. 74
DeActivated Event ...................................... 75
Syntax .................................................. 75
Properties ............................................. 76
Remarks ............................................... 76
E-N .............................................................. 77
Edit Event ................................................... 77
Syntax .................................................. 77
Properties ............................................. 77
Remarks ............................................... 78
EditChange Event ...................................... 79
Syntax .................................................. 79
Properties ............................................. 79
Initialize Event ............................................ 80
Syntax .................................................. 80
Properties ............................................. 80
InitializeConfigure Event ............................. 81
Syntax .................................................. 81
Properties ............................................. 81
KeyDown Event .......................................... 82
Syntax .................................................. 82
Properties ............................................. 82
Settings ................................................ 84
Remarks ............................................... 84
KeyUp Event .............................................. 85
Syntax .................................................. 85
Properties ............................................. 86
Settings ................................................ 86
Remarks ............................................... 87
LMouseClick Event ..................................... 88
Syntax .................................................. 88
Properties ............................................. 88
LoadedTagGroup Event ............................. 89
Syntax .................................................. 89
Properties ............................................. 90
MouseDown Event ..................................... 90
Syntax .................................................. 90
Properties ............................................. 91
Settings ................................................ 92
Remarks ............................................... 94
MouseMove Event ...................................... 95
Syntax .................................................. 95
Properties ............................................. 95
Settings ................................................ 97
Remarks ............................................... 99
MouseUp Event .......................................... 99
Syntax .................................................. 99
Properties ............................................. 99
Settings ................................................ 101
Remarks ............................................... 102
MouseUpOffObject Event ........................... 104
Syntax .................................................. 104
Properties ............................................. 104
Remarks ............................................... 105
NewAlarm Event......................................... 106
Syntax .................................................. 106
Properties ............................................. 107
Remarks ............................................... 107
O-Z .............................................................. 108
OnChange Event ........................................ 108
Syntax .................................................. 108
Properties ............................................. 108
OnChartFull Event ...................................... 109
Syntax .................................................. 109
Properties ............................................. 109
Remarks ............................................... 110
OnChartRefresh Event ............................... 110
Syntax .................................................. 110
Properties ............................................. 111
OnFalse Event............................................ 111
Syntax .................................................. 111
Properties ............................................. 111
Remarks ............................................... 112
OnPenSelect Event .................................... 112
Syntax .................................................. 113
Properties ............................................. 113
OnTimeOut Event....................................... 113
Syntax .................................................. 114
Properties ............................................. 114
OnTrue Event ............................................. 115
Syntax .................................................. 115
Properties ............................................. 115
Remarks ............................................... 116
RMouseClick Event .................................... 117
Syntax .................................................. 117
Properties ............................................. 117
SelectionChanged Event ............................ 118
SeverityIncreased Event............................. 119
Syntax .................................................. 119
Properties ............................................. 119
UIDeactivate Event ..................................... 120
WhileFalse Event ....................................... 120
Syntax .................................................. 120
Properties ............................................. 121
Remarks ............................................... 121
WhileTrue Event ......................................... 121
Syntax .................................................. 122
Properties ............................................. 122
Remarks ............................................... 122
Subroutines ................................................. 123
A-F .............................................................. 123
AcknowledgeAllAlarms Subroutine ............. 123
Syntax .................................................. 124
Properties ............................................. 124
Remarks ............................................... 126
AcknowledgeAnAlarm Subroutine .............. 127
Syntax .................................................. 127
Properties ............................................. 127
AlarmHornEnabled Subroutine ................... 129
Syntax .................................................. 129
Properties ............................................. 129
Return Value ........................................ 131
AlarmHornEnabledToggle Subroutine ........ 131
Syntax .................................................. 131
Properties ............................................. 131
Return Value ........................................ 132
AlarmHornSilence Subroutine .................... 133
Syntax .................................................. 133
Properties ............................................. 133
Remarks ............................................... 134
CloseDigitalPoint Subroutine ...................... 135
Syntax .................................................. 135
Properties ............................................. 135
Remarks ............................................... 137
ClosePicture Subroutine ............................. 137
Syntax .................................................. 137
Properties ............................................. 137
Remarks ............................................... 139
DisableAlarm Subroutine ............................ 140
Syntax .................................................. 140
Properties ............................................. 140
EnableAlarm Subroutine............................. 143
Syntax .................................................. 143
Properties ............................................. 143
FetchLimits Subroutine ............................... 145
Syntax .................................................. 145
Properties ............................................. 145
FindDataSource Subroutine ....................... 148
Syntax .................................................. 148
Properties ............................................. 148
Return Value ........................................ 149
Remarks ............................................... 150
FindLocalObject Subroutine ....................... 150
Syntax .................................................. 150
Properties ............................................. 150
Return Value ........................................ 151
Remarks ............................................... 152
G-I ............................................................... 153
GeneratePicture Subroutine ....................... 153
Syntax .................................................. 153
Properties ............................................. 153
GetAllConnections Subroutine.................... 157
Syntax .................................................. 157
Properties ............................................. 157
Return Value ........................................ 158
GetDecimalSeparator Subroutine ............... 158
Syntax .................................................. 158
Properties ............................................. 159
GetFormDynamoColor Subroutine ............. 160
Syntax .................................................. 160
GetFormNumeric Subroutine ...................... 160
Syntax .................................................. 160
GetFormPushbutton Subroutine ................. 160
Syntax .................................................. 160
GetFormRamp Subroutine ......................... 161
Syntax .................................................. 161
GetFormSlider Subroutine .......................... 161
Syntax .................................................. 161
GetLocaleInfoA Subroutine ........................ 161
Syntax .................................................. 162
Properties ............................................. 162
Return Value ........................................ 163
Remarks ............................................... 163
GetUserDefaultLCID Subroutine ................ 164
Syntax .................................................. 164
Return Value ........................................ 164
Remarks ............................................... 164
HandleError Subroutine .............................. 164
Syntax .................................................. 165
Properties ............................................. 165
IsUserFxg Subroutine ................................. 167
Syntax .................................................. 167
Return Value ........................................ 167
Remarks ............................................... 167
L-R .............................................................. 168
LocateObject Subroutine ............................ 168
Syntax .................................................. 168
Properties ............................................. 168
LogIn Subroutine ........................................ 171
Syntax .................................................. 171
Properties ............................................. 171
OffScan Subroutine .................................... 173
Syntax .................................................. 173
Properties ............................................. 173
OnScan Subroutine .................................... 175
Syntax .................................................. 175
Properties ............................................. 175
OpenDigitalPoint Subroutine ...................... 177
Syntax .................................................. 177
Properties ............................................. 177
Remarks ............................................... 179
OpenPicture Subroutine ............................. 179
Syntax .................................................. 179
Properties ............................................. 179
Remarks ............................................... 183
OpenTGDPicture Subroutine ...................... 184
Syntax .................................................. 185
Properties ............................................. 185
Remarks ............................................... 188
PictureAlias Subroutine .............................. 189
Syntax .................................................. 189
Properties ............................................. 189
PrintReport Subroutine ............................... 191
Syntax .................................................. 191
Properties ............................................. 191
QuickAdd Subroutine.................................. 194
Syntax .................................................. 195
Properties ............................................. 195
Return Value ........................................ 197
RampValue Subroutine .............................. 197
Syntax .................................................. 198
Properties ............................................. 198
ReadValue Subroutine ............................... 200
Syntax .................................................. 200
Properties ............................................. 200
Return Value ........................................ 201
RegCloseKey Subroutine ........................... 202
Syntax .................................................. 202
Properties ............................................. 202
Return Value ........................................ 203
Remarks ............................................... 203
RegOpenKeyEx Subroutine........................ 203
Syntax .................................................. 204
Properties ............................................. 204
Return Value ........................................ 206
Remarks ............................................... 206
ReplacePicture Subroutine ......................... 206
Syntax .................................................. 207
Properties ............................................. 207
Remarks ............................................... 210
ReplaceTGDPicture Subroutine ................. 212
Syntax .................................................. 213
Properties ............................................. 213
Remarks ............................................... 215
S-Z .............................................................. 216
SetAuto Subroutine .................................... 216
Syntax .................................................. 216
Properties ............................................. 216
SetManual Subroutine ................................ 218
Syntax .................................................. 218
Properties ............................................. 218
ShellExecute Subroutine ............................ 220
Syntax .................................................. 220
Properties ............................................. 220
Return Value ........................................ 222
Remarks ............................................... 222
ToggleDigitalPoint Subroutine .................... 222
Syntax .................................................. 222
Properties ............................................. 222
ToggleManual Subroutine .......................... 224
Syntax .................................................. 224
Properties ............................................. 224
ToggleScan Subroutine .............................. 226
Syntax .................................................. 226
Properties ............................................. 226
WriteValue Subroutine................................ 228
Syntax .................................................. 228
Properties ............................................. 228
Database Functions..................................... 230
Database Functions Summary..................... 230
eda_add_block Function ............................ 231
Syntax .................................................. 231
Properties ............................................. 231
Return Value ........................................ 232
Remarks ............................................... 233
eda_delete_block Function ......................... 233
Syntax .................................................. 233
Properties ............................................. 233
Return Value ........................................ 234
Remarks ............................................... 234
eda_get_pdb_name Function ..................... 235
Syntax .................................................. 235
Properties ............................................. 235
Return Value ........................................ 236
Remarks ............................................... 237
eda_reload_database Function .................. 238
Syntax .................................................. 238
Properties ............................................. 238
Return Value ........................................ 239
Remarks ............................................... 239
eda_save_database Function..................... 240
Syntax .................................................. 240
Properties ............................................. 240
Return Value ........................................ 241
Remarks ............................................... 241
eda_type_to_index Function....................... 242
Syntax .................................................. 242
Properties ............................................. 242
Return Value ........................................ 243
Remarks ............................................... 243
FixGetMyname Function ............................ 244
Syntax .................................................. 244
Properties ............................................. 244
Return Value ........................................ 245
Remarks ............................................... 246
NlsGetText Function ................................... 248
Syntax .................................................. 248
Properties ............................................. 248
Return Value ........................................ 249
Remarks ............................................... 250
Examples .................................................... 253
A.................................................................. 253
AboutBox Method Example ........................ 253
AckAlarm Method Example ........................ 253
AckAlarmPage Method Example ................ 254
AckAlarmPageEx Method Example ............ 254
AckAllAlarms Method Example................... 254
AcknowledgeAllAlarms Subroutine
Example ..................................................... 255
AcknowledgeAnAlarm Subroutine
Example ..................................................... 255
ActivateWorkspaceUI Method Example ...... 256
Add Method Example ................................. 256
AddDataSet Method Example .................... 257
AddEventHandler Method Example ............ 258
AddImage Method Example ....................... 259
AddLegendItem Method Example .............. 259
AddLevel Method Example ......................... 260
AddObject Method Example ....................... 260
AddPen Method Example ........................... 261
AddPictureToStartupList Example .............. 261
AddPoint Method Example ......................... 262
AddProcedure Method Example ................. 263
AlarmHornEnabled Example ...................... 264
Example 1 ............................................ 264
Example 2 ............................................ 264
AlarmHornEnabledToggle Example............ 265
AlarmHornSilence Example ........................ 266
Align Method Example................................ 266
ApplyProperty Method Example ................. 266
AutoScaleDisplayLimits Method Example... 267
B.................................................................. 267
BringToFront Method Example ................... 267
BuildObject Method Example ..................... 268
C ................................................................. 269
CanConstruct Method Example .................. 269
CheckAccountExpiration Method
Example ..................................................... 269
CheckSecurityEnabled Method Example .... 272
CheckSyntax Method Example................... 274
CheckUserApplicationAccess Method
Example ..................................................... 274
CheckUserAreaAccess Method Example ... 277
Clear Method Example ............................... 280
ClearUndo Method Example....................... 280
Close Method Example .............................. 280
CloseDigitalPoint Subroutine Example ....... 281
ClosePicture Subroutine Example .............. 281
Commit Method Example ........................... 282
Connect Method Example .......................... 283
ConnectDataSet Method Example.............. 285
ConnectedPropertyCount Method
Example ..................................................... 285
Construct Method Example ........................ 285
Convert_A_Group_To_A_Dynamo_By_N
ame Method Example................................. 286
Convert_A_Group_To_A_Dynamo_By_R
ef Method Example .................................... 286
ConvertPipe Method Example .................... 293
ConvertSecurityAreaNameToNumber
Method Example ........................................ 294
ConvertSecurityAreaNumberToName
Method Example ........................................ 294
Copy Method Example ............................... 295
Coupled_Activate_Workspace_UI Method
Example ..................................................... 295
Coupled_DeActivate_Workspace_UI
Method Example ........................................ 295
CopyAsBitmap Method Example ................ 296
CreateDynamoByGrouping Method
Example ..................................................... 297
CreateFromDialog Method Example........... 298
CreateFromProgID Method Example.......... 299
CreateWithMouse Method Example ........... 300
Cut Method Example .................................. 300
D ................................................................. 301
DeActivateWorkspaceUI Method Example . 301
DefaultView Method Example..................... 302
DelAlarm Method Example ......................... 302
DeleteAllAlarms Method Example .............. 303
DeleteAllDataSets Method Example ........... 303
DeleteDataSet Method Example ................ 303
DeleteImage Method Example ................... 304
DeletePen Method Example ....................... 304
DeletePoint Method Example ..................... 309
DeleteSelectedObjects Method Example.... 310
DemandFire Method Example .................... 310
DeselectObject Method Example ............... 311
DestroyObject Method Example ................. 311
DisableAlarm Subroutine Example ............. 312
DisableNonSelectionEvents Method
Example ..................................................... 312
Disconnect Method Example ...................... 312
DisplaysControlPoints Method Example ..... 313
DoesPropertyHaveTargets Method
Example ..................................................... 313
DoExtendLines Method Example ............... 314
DoLinestoPolyline Method Example ........... 315
DoMenuCommand Method Example .......... 315
DoTrimLines Method Example ................... 316
DumpProperties Method Example .............. 317
Duplicate Method Example ......................... 317
E.................................................................. 318
EditPicture Method Example ...................... 318
Enable Method Example ............................ 318
EnableAlarm Subroutine Example .............. 318
Enumerate_All_Dynamos Method
Example ..................................................... 319
Enumerate_All_Groups Method Example ... 321
Enumerate_Top_Level_Dynamos Method
Example ..................................................... 324
Enumerate_Top_Level_Groups Method
Example ..................................................... 326
ESignature Object Example........................ 329
ExchangePenPositions Method Example ... 331
ExportData Method Example ...................... 331
ExportImage Method Example ................... 332
ExportLanguageFile Method Example ........ 332
F .................................................................. 333
FetchLimits Subroutine Example ................ 333
FindAndReplaceDialog Method Example ... 334
FindDataSource Subroutine Example ......... 334
FindInString Method Example .................... 335
FindLocalObject Subroutine Example ......... 336
FindObject Method Example ...................... 336
FindReplaceInObject Method Example ...... 337
FindReplaceInString Method Example ....... 338
FitDocumentToWindow Method Example ... 339
FitWindowToDocument Method Example ... 339
FixCheckApplicationAccess Method
Example ..................................................... 340
FixCheckApplicationAccessQuiet Method
Example ..................................................... 341
FixCheckAreaAccess Method Example ...... 341
FixCheckAreaAccessQuiet Method
Example ..................................................... 342
FixCheckSecurityEnabled Method
Example ..................................................... 342
FixGetManualAlmDeleteEnabled Method
Example ..................................................... 343
FixGetUserInfo Method Example ................ 344
FixLogin Method Example .......................... 344
FixLogout Method Example ........................ 345
FontProperties Method Example ................ 345
FullView Method Example .......................... 345
G ................................................................. 346
GeneratePicture Subroutine Example ........ 346
Get_Last_Prompt_Value Method
Example ..................................................... 347
To view this code in context:................. 352
Get_Last_Result_String Method Example .. 353
To view this code in context:................. 359
GetAllConnections Subroutine Example ..... 360
GetBoundRect Method Example ................ 361
GetColHeadings Method Example.............. 362
GetColumnInfo Method Example ................ 362
GetConnectionInformation Method
Example ..................................................... 363
GetConnectionParameters Method
Example ..................................................... 364
GetContinuousUser Method Example ........ 365
GetCurrentDataSet Method Example ......... 367
GetCurrentValueWithQuality Method
Example ..................................................... 368
GetCurrentValue Method Example ............. 369
GetDataSetByPosition Method Example .... 370
GetDecimalSeparator Subroutine
Example ..................................................... 371
GetDeviceRect Method Example ................ 371
GetDuration Method Example .................... 372
GetErrorString Method Example ................. 373
GetEventHandlerIndex Method Example .... 374
GetFormDynamoColor Subroutine
Example ..................................................... 374
GetFormNumeric Subroutine Example ....... 375
GetFormPushbutton Subroutine Example .. 375
GetFormRamp Subroutine Example ........... 375
GetFormSlider Subroutine Example ........... 375
GetFullname Method Example ................... 376
GetIndirectionInfo Method Example............ 379
GetInterval Method Example ...................... 380
GetNumberOfDataSets Method Example ... 380
GetLevel Method Example ......................... 381
GetLocaleInfoA Subroutine Example .......... 381
GetObjectInfo Method Example .................. 383
GetPenDataArray Method Example............ 384
GetPenDataArrayEx Method Example ....... 387
GetPointAt Method Example ...................... 388
GetPriorityColor Method Example .............. 389
GetProcedureIndex Example...................... 390
GetProperty Method Example .................... 391
GetPropertyAttributes Method Example ..... 392
GetPropertyTargets Method Example ........ 393
GetSelectedAlmExt Method Example ......... 393
GetSelectedNodeTag Method Example ..... 394
GetSelectedRow Method Example ............. 394
GetSelectedUserDefFields Method
Example ..................................................... 396
GetSignature Method Example................... 396
GetSignatureAndWriteValue Method
Example ..................................................... 400
GetStatusColor Method Example ............... 402
GetStatusFont Method Example ................. 403
GetTimeBeforeNow Method Example ........ 404
GetTimeCursorInfo Method Example ......... 404
GetUserDefaultLCID Subroutine Example .. 405
GetUserID Method Example ....................... 406
GetWindowLocation Method Example ........ 409
GlobalScrollBackFast Method Example ...... 410
GlobalScrollBackSlow Method Example ..... 411
GlobalScrollForwardFast Method
Example ..................................................... 412
GlobalScrollForwardSlow Method
Example ..................................................... 413
GlobalTimerApply Method Example ........... 414
Group Method Example.............................. 414
H ................................................................. 415
HandleError Subroutine Example ............... 415
HiLoDisplay Method Example..................... 416
I-K ............................................................... 417
ImportToolbar Method Example ................. 417
Initialize Method Example ........................... 417
InitializeList Method Example ..................... 420
InsertPoint Method Example....................... 423
InteractiveExport Method Example ............. 423
IsColorSelectionVisible Method Example ... 424
IsConnected Method Example.................... 424
IsEmpty Method Example ........................... 425
IsNodeSignEnabled Method Example ........ 425
IsSignatureRequired Method Example ....... 428
IsSignatureRequiredForList Method
Example ..................................................... 431
IsUserFxg Subroutine Example .................. 433
Item Method Example................................. 434
L .................................................................. 435
ListEvents Method Example ....................... 435
ListMethods Method Example .................... 436
ListProperties Method Example .................. 437
ListWindowsGroupNames Method
Example ..................................................... 438
Load_TS_List Method Example .................. 439
LoadImage Method Example ...................... 439
LoadTagGroupFile Example ....................... 440
LocateObject Subroutine Example ............. 440
LogicalToPercentage Method Example ...... 441
LogicalToUserFormPoint Method
Example ..................................................... 442
LogIn Subroutine Example ......................... 442
M-N ............................................................. 443
MakeLinesHorizontal Method Example ...... 443
MakeLinesVertical Method Example........... 443
MakeSameSize Method Example ............... 444
Modify Method Example ............................. 444
ModifyColumnLength Method Example ...... 445
Move Method Example ............................... 445
NewAlarm Event Example .......................... 445
O ................................................................. 447
OffScan Subroutine Example ..................... 447
OnScan Subroutine Example ..................... 447
Open Method Example ............................... 448
Open_QT_Pic Method Example ................. 448
Open_QT_Pic_Ex Method Example ........... 449
Open_TCP_Pic Method Example ............... 450
Open_TCP_Pic_Ex Method Example ......... 451
Open_TS_Pic Method Example ................. 452
Open_TS_Pic_Ex Method Example ........... 453
Open_TS_Pic_Type Method Example ........ 454
Open_TS_Pic_Type_Ex Method Example.. 457
OpenDigitalPoint Subroutine Example ........ 460
OpenPicture Subroutine Example .............. 460
OpenTGDPicture Subroutine Example ....... 463
P-Q .............................................................. 465
ParseConnectionSource Method Example . 465
Paste Method Example .............................. 466
PasteSpecial Method Example ................... 466
Pause Method Example ............................. 466
PauseAlarmRead Method Example ............ 467
PercentageToLogical Method Example ...... 468
PercentageToPixel Method Example.......... 469
PictureAlias Subroutine Example ............... 470
PixelToPercentage Method Example.......... 470
PrintChart Method Example........................ 471
PrintOut Method Example .......................... 471
PrintReport Subroutine Example ................ 472
PromptToChangePassword Method
Example ..................................................... 472
QuickAdd Subroutine Example ................... 475
Quit Method Example ................................. 475
R ................................................................. 476
RampValue Subroutine Example ................ 476
Read Method Example ............................... 476
ReadValue Subroutine Example ................. 478
Refresh Method Example ........................... 478
RefreshChartData Method Example ........... 478
RegCloseKey Subroutine Example............. 481
RegOpenKeyEx Subroutine Example ......... 483
Remove Method Example .......................... 486
RemoveAll Method Example ...................... 487
RemoveAllLevels Method Example ............ 488
RemoveItem Method Example ................... 488
RemoveLegendItem Method Example ........ 488
RemoveLevel Method Example .................. 489
RemoveObject Method Example ................ 489
ReplacePicture Subroutine Example .......... 490
RemovePictureFromStartupList Example ... 491
Replace_QT_Pic Method Example ............. 492
Replace_TCP_Pic Method Example........... 493
Replace_TS_Pic_Type Method Example ... 493
Replace_TS_Pic Method Example ............. 494
ReplaceDocument Method Example .......... 495
ReplaceInString Method Example .............. 495
ReplaceTGDPicture Subroutine Example ... 496
ResetChartData Method Example .............. 497
ResetObjectStats Method Example ............ 497
ResetStats Method Example ...................... 498
ResetZoom Method Example ..................... 498
ResolveTagGroupFile Example .................. 499
Resume Method Example .......................... 499
ResumeAlarmRead Method Example ......... 499
RetrieveDefinition Method Example............ 501
RetrieveTagGroupVariables Method
Example ..................................................... 502
Rotate Method Example ............................. 502
RunObject Method Example ....................... 503
S.................................................................. 504
Save Method Example ............................... 504
Save_TS_List Method Example ................. 505
SaveAsSVG Method Example .................... 505
SaveToHistoryList Method Example ........... 506
ScrollBack Method Example ....................... 506
ScrollForward Method Example .................. 507
ScrollTimeBack Method Example ............... 507
ScrollTimeForward Method Example .......... 507
Select Method Example.............................. 508
SelectAlarmRow Method Example ............. 508
SelectAll Method Example .......................... 509
SelectObject Method Example ................... 510
SendOperatorMessage Method Example ... 510
SendSignedOperatorMessage Method
Example ..................................................... 511
SendToBack Method Example ................... 515
SetAuto Subroutine Example...................... 515
SetContinuousUser Method Example ......... 515
SetCurrentValue Method Example ............. 517
SetDispatch Method Example .................... 517
SetDispid Method Example ........................ 518
SetDuration Method Example ..................... 518
SetFocusToComboBox Method Example ... 518
SetGlobalMovingEndTimeToCurrent
Method Example ........................................ 519
SetIndirectionInfo Method Example ............ 519
SetInterval Method Example....................... 519
SetManual Subroutine Example ................. 520
SetLegendMask Method Example .............. 520
SetNumericFormat Method Example .......... 521
SetPenDataArray Method Example ............ 521
SetPointAt Method Example ....................... 524
SetPriorityColor Method Example ............... 525
SetProperty Method Example ..................... 526
SetScriptWindow Method Example............. 526
SetSource Method Example ....................... 527
SetStatusColor Method Example ................ 527
SetStatusFont Method Example ................. 528
SetStringFormat Method Example .............. 528
SetTabSelection Method Example.............. 529
SetTimeBeforeNow Method Example ......... 529
SetTimeCursorTime Method Example ........ 530
SetWindowLocation Method Example ........ 530
ShellExecute Subroutine Example.............. 531
ShowAnimations Method Example ............. 531
ShowBrowseDialog Method Example ......... 531
ShowColorBox Method Example ................ 532
ShowColorSelection Method Example ........ 532
ShowCustomPages Method Example ........ 532
ShowPipePreviewDialog Method
Example ..................................................... 533
ShowTaskWizard Method Example ............ 533
ShowVBAProcedure Method Example ....... 534
ShowVisualBasicEditor Method Example ... 534
AlarmHornSilence Example ........................ 535
SnapObjectsToGrid Method Example ........ 535
SpaceEvenly Method Example ................... 536
StartEvent Method Example ....................... 536
StartTimer Method Example ....................... 537
StickToCursor Method Example ................. 538
StopEvent Method Example ....................... 539
StopTimer Method Example ....................... 539
Stretch Method Example ............................ 540
SwitchLanguage Method Examples............ 540
SwitchMode Method Example .................... 541
SynchronizeSecurity Method Example ....... 541
To add a VBA reference to
[Link]: ............. 542
T .................................................................. 544
TagGroupSubstitution Method Example ..... 544
TagGroupValue Method Example .............. 545
ToggleDigitalPoint Subroutine Example ..... 546
ToggleManual Subroutine Example ............ 546
ToggleScan Subroutine Example ............... 546
U ................................................................. 547
UIActivate Method Example ....................... 547
UIDeActivate Method Example ................... 547
Undo Method Example ............................... 547
UndoTransaction Method Example............. 548
UndoZoom Method Example ...................... 548
UnGroup Method Example ......................... 548
UnloadTagGroupFile Method Example ....... 549
Update_A_Dynamo_By_Name Method
Example ..................................................... 549
Update_A_Dynamo_By_Name2 Method
Example ..................................................... 555
Update_A_Dynamo_By_Ref Method
Example ..................................................... 555
To view this code in context:................. 562
Update_A_Dynamo_By_Ref2 Method
Example ..................................................... 563
To view this code in context:................. 568
UpdateBackgroundObject Method
Example ..................................................... 568
UpdateConnectionParameters Method
Example ..................................................... 569
UpdateDefinition Method Example ............. 570
UserFormPointToLogical Method
Example ..................................................... 572
V-Z .............................................................. 573
ValidateSignature Method Example............ 573
ValidateSignatureAndWriteValue Method
Example ..................................................... 575
ValidateSource Method Example ............... 578
ValueTimeFromXY Method Example.......... 579
WritePictureToImageFile Method
Example ..................................................... 579
WriteValue Subroutine Example ................. 580
Write Method Example ............................... 580
XYFromValueTime Method Example.......... 582
XYHitTest Method Example........................ 583
Zoom Method Example .............................. 584
About this Guide
The iFIX Automation Reference is intended
for integrators and programmers who want to
develop applications that access and
manipulate information within the Proficy
iFIX environment through a set of automation
interfaces. This help file assumes the reader is
proficient in the Microsoft® Visual Basic®
programming language.
The following sections provide more details on
how to use the objects, properties, methods,
events, subroutines, and database functions
associated with iFIX:
• Event Summary
• Subroutine Summary
• Database Functions Summary
• Examples
Events
A-D
Activated Event
Occurs when a window gets the user focus.
This is defined as the moment when the user’s
keyboard and mouse focus are directed to that
window. The user can tell this is happening by
looking at the titlebar (if the document has
one).
Syntax
object_Activated( )
Properties
The Activated event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
AfterKillFocus Event
Occurs when focus is taken away from the
specified ExpressionEditor control.
Syntax
object_AfterKillFocus( )
Properties
The AfterKillFocus event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
AlarmAck Event
Occurs when an alarm is acknowledged.
Syntax
object_AlarmAck( )
Properties
The AlarmAck event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
AlarmAcknowledged Event
Occurs when an alarm is acknowledged by
double-clicking an alarm or calling the
AckAlarm, AckAlarmPage, or the
AckAllAlarms methods. Unlike the AlarmAck
event, the AlarmAcknowledged event returns
the name of the node, tag, and field that was
acknowledged.
Syntax
object_AlarmAcknowledged(strNode As
String, strTag As String, strField As String)
Properties
The AlarmAcknowledged event syntax has
these parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
strNode String. The name of the node on
which the alarm was
acknowledged.
StrTag String. The name of the tag
whose alarm was
acknowledged.
StrField String. The name of the field
whose alarm was
acknowledged.
Remarks
If you acknowledge a page of alarms, you
receive one event for each alarm. If you
acknowledge all alarms, the event does not
occur.
AlarmListChanged Event
Occurs when the contents or order of
information in the Alarm Summary object
changes. By default, this event does not fire.
To trigger the event when information in the
Alarm Summary object changes, set the
CheckForAlarmListChanged property to
TRUE.
Syntax
object_AlarmListChanged()
Properties
The AlarmListChanged event syntax has this
part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
This event occurs on the initial receipt of
alarms by the Alarm Summary object. The
event occurs subsequently whenever the
contents or order of alarms displayed by the
Alarm Summary object changes. For example,
the event may also occur when you change the
alarm filter if the modified filter changes the
content of the object’s spreadsheet (for
example, if it filters out alarms or adds alarms
from another alarm area). The event occurs
even if the change in content happens off
screen.
The following actions may also cause the
AlarmListChanged event to fire but only if
the action changes the content of the object’s
spreadsheet:
• Changing the sort order.
• Detecting/receiving a new alarm.
You can disable the AlarmListChanged event
by setting the CheckForAlarmListChanged
property to FALSE.
Click Event
Occurs when the user releases the left mouse
key in the Run-time environment.
Syntax
object_Click( )
Properties
The Click event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
This event is the common event used to initiate
an operator action. It is also the default event
used by the script authoring wizards.
The sequence of mouse-related events is:
• MouseDown
• MouseUp
• Click
• DblClick
Close Event
Occurs when a page container is shut down or
closed in the Run-time environment.
Syntax
object_Close( )
Properties
The Close event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
ColorChanged Event
Occurs when a new color is selected in the
Run-time environment.
Syntax
object_ColorChanged(ByVal Color As Long)
Properties
The ColorChanged event syntax has these
parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
Color The newly selected color.
DataChange Event
Occurs when a data source’s value changes by
more than the deadband limit or if the quality
or error information associated with the data
source changes.
The DataChange event occurs at the end of
data change processing, therefore, the
animation or event object’s internal state
(properties) will reflect this change. The
previous value is not stored in the object.
If the same events occur while the script is
executing, the system queues one and only one
event for this situation. That is, if multiple data
changes occur, the next event firing reflects the
newest information.
Syntax
object_DataChange(ByVal DataValue As
Variant, ByVal TimeStamp as Date, ByVal
Transition As Long, ByVal Reserved As
Variant)
Properties
The DataChange event syntax has these parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
DataValue The new data value.
TimeStamp The time that this data
arrived in the system.
Transition Specifies whether the value
changed from non-zero to
zero or vice versa.
Reserved Reserved.
Event Firing Definition
Value Transition Fire Event Sequence
Uninitialized to True DataChange, WhileTrue
True to False DataChange, OnFalse, WhileFalse
False to True DataChange, OnTrue, WhileTrue
False to Error DataChange
True to Error DataChange
Error to True DataChange, WhileTrue
Error to False DataChange, WhileFalse
Uninitialized to Error DataChange
Uninitialized to False DataChange, WhileFalse
When data changes from an unknown state to a
known state, the DataChange event triggers.
Therefore, actions such as switching from the
Configuration environment to the Run-time
environment while an iFIX schedule is open
will cause the DataChange event to trigger
accordingly.
Using the DataChange Event in a
Datalink
If you are attempting to use the DataChange
Event in a data link, you cannot create the
VBA object by selecting Edit Script from the
right-click menu.
To create your own object:
1. Create a data link.
2. Open the VBA editor.
3. Enter the Private Sub
object_DataChange(ByVal DataValue
As Variant, ByVal TimeStamp as Date,
ByVal Transition As Long, ByVal
Reserved As Variant) string and press
Enter.
4. Enter any desired code.
5. Enter End Sub at the end of the
subroutine.
DblClick Event
Occurs when the user double-clicks the mouse.
Syntax
object_DblClick( )
Properties
The DblClick event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
The DblClick event occurs when multiple left
mouse clicks are received in the object.
The sequence of mouse-related events is:
• MouseDown
• MouseUp
• Click
• DblClick
Alarm Summary Syntax
object_DblClick(ByVal Col As Long, ByVal
Row As Long)
Properties
The DblClick event syntax has these parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
Col The column in which the user
double clicked.
Row The row in which the user double
clicked.
DeActivated Event
Occurs when a window loses the focus. This is
fired when another document receives the
focus.
Syntax
object_DeActivated( )
Properties
The DeActivated event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
When a picture is closed, the DeActivated
event does not fire.
E-N
Edit Event
Occurs when:
• The user double clicks an object in the
Configuration environment.
• The user pastes an object into a page
from a DynamoSet.
Syntax
object_Edit( )
Properties
The Edit event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
This method is the primary mechanism for
creating a custom property page for an object
that is in the form of a VBA custom form,
which is useful for creating Dynamo objects.
When an object is modified, the order of
execution is:
1. If the object has an edit event, it is
fired.
2. If the object has a custom property
page (ocxes, chart objects, alarm
summary objects), it is fired.
3. Otherwise, the animation dialog box is
displayed.
TIP: Put all substitution logic in the Edit event
and pass all object context into a shared or
global form. Object names are automatically
modified on a duplicate if the reference is in the
event handler. Hard-coded object references in
user forms are not modified when an object is
duplicated.
EditChange Event
Occurs when the text in the edit box portion of
the ExpressionEditor is changed.
Syntax
object_EditChange(ByVal bSourceEmpty As
Boolean)
Properties
The EditChange event syntax has these parts:
Part Description
Object An object expression that
evaluates to an object in
the Applies To list.
bSourceEmpty Whether the edit box is
empty or not. If True, the
edit box is empty. If
False, the edit box is not
empty.
Initialize Event
Occurs when a document is opened in the Run-
time environment.
Syntax
object_Initialize( )
Properties
The Initialize event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
InitializeConfigure Event
Occurs when a document is opened in the
Configuration environment, or when the user
switches to the Configuration environment.
Syntax
object_InitializeConfigure( )
Properties
The InitializeConfigure event syntax has this
part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
KeyDown Event
Occurs when the user presses a key on the
keyboard.
Syntax
object_KeyDown(ByVal KeyCode As Long,
ByVal Shift As Long, ContinueProcessing As
Boolean)
Properties
The KeyDown event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
KeyCode An integer that represents the
key code of the key that was
pressed or released.
Shift The state of the SHIFT, CTRL,
and ALT keys.
Settings
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
4 ALT was pressed.
Remarks
Key events are sent to the selected object first.
If there is no script tied to the event, the key
event is sent to the contained object (group or
page). If you have common key events across a
set of pictures, it is recommended that you use
shared subroutines in the user global page that
are called from the picture’s key events.
The ContinueProcessing As Boolean
parameter is related to the Key Macro scheme.
Since key macros can be tied to objects, there
is a certain hierarchy. For example, you can
have the same key macro run different scripts
on an object and in the picture. The processing
starts in the object, and the ContinueProcessing
parameter prevents the processing from being
passed up to the next level. For example, if
F10 runs MacroA on a rectangle, and F10 also
runs MacroB in the picture, a false value
would keep the picture's macro from firing.
KeyUp Event
Occurs when the user presses a key on the
keyboard.
The object placeholder represents an object
expression that evaluates to an object in the
Applies To list.
Syntax
object_KeyUp(ByVal KeyCode As Long,
ByVal Shift As Long, ContinueProcessing As
Boolean)
Properties
The KeyUp event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
KeyCode An integer that represents the
key code of the key that was
pressed or released.
Shift The state of the SHIFT, CTRL,
and ALT keys.
Settings
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
4 ALT was pressed.
Remarks
Key events are sent to the selected object first.
If there is no script tied to the event, the key
event is sent to the contained object (group or
page). If you have common key events across a
set of pictures, it is recommended that you use
shared subroutines in the user global page that
are called from the picture’s key events.
The ContinueProcessing As Boolean
parameter is related to the Key Macro scheme.
Since key macros can be tied to objects, there
is a certain hierarchy. For example, you can
have the same key macro run different scripts
on an object and in the picture.
The processing starts in the object, and the
ContinueProcessing parameter prevents the
processing from being passed up to the next
level. For example, if F10 runs MacroA on a
rectangle, and F10 also runs MacroB in the
picture, a false value would keep the picture's
macro from firing.
LMouseClick Event
Occurs when the user clicks the left mouse
button on the Alarm Summary object in
either the Configuration or Run-time
environment.
Syntax
object_LMouseClick(ByVal Col As Long,
ByVal Row As Long)
Properties
The LMouseClick event syntax has these
parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Col The column the user clicked on.
Row The row the user clicked on.
LoadedTagGroup Event
Occurs when the user loads a tag group in the
runtime environment.
Syntax
object_LoadedTagGroup(TagGroupName As
String)
Properties
The LoadedTagGroup event syntax has these
parts:
Part Description
object An object expression
that evaluates to an
object in the Applies To
list.
TagGroupName String. The name of the
tag group.
MouseDown Event
Occurs when the user presses a mouse button.
Syntax
object_MouseDown(ByVal Button As
Integer, ByVal Shift As Integer, ByVal X As
Double, byVal Y As Double)
Properties
The MouseDown event syntax has these parts:
Part Description
object An object expression that evaluates to
an object in the Applies To list.
Button An integer value that identifies which
mouse button was pressed.
Shift The state of the SHIFT, CTRL, and
ALT keys.
X The horizontal position, in logical
coordinates, from the left or top edge of
the page where the mouse was pressed.
Y The vertical position, in logical
coordinates, from the left or top edge of
the page where the mouse was pressed.
Settings
The settings for Button are:
Value Description
1 The left button was pressed.
2 The right button was pressed.
4 The middle button was pressed.
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
3 SHIFT and CTRL were pressed.
4 ALT was pressed.
5 ALT and SHIFT were pressed.
6 ALT and CTRL were pressed.
7 ALT, SHIFT, and CTRL were
pressed.
Remarks
The sequence of mouse-related events is:
• MouseDown
• MouseUp
• Click
• DblClick
MouseDown or MouseUp event procedures
specify actions that occur when a mouse button
is pressed or released. They enable you to
distinguish between the left, right, and middle
mouse buttons. You can also write code for
mouse-keyboard combinations that use the
SHIFT, CTRL, and ALT keyboard modifiers.
Use the Shift argument to identify the state of
the SHIFT, CTRL, and ALT keys when the
MouseDown or MouseUp event occurred. For
example, if both CTRL and ALT are pressed,
the value of Shift is 6.
Mouse events are sent to the selected object
first. If there is no event script tied to the
selected object, then the event is sent to the
object’s container (group or page).
MouseMove Event
Occurs when the user moves the mouse over
an object.
Syntax
object_MouseMove(ByVal Button As
Integer, ByVal Shift As Long, ByVal X As
Double, ByVal Y As Double)
Properties
The MouseMove event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Button An integer value that identifies
which mouse button was pressed.
Shift The state of the SHIFT, CTRL,
and ALT keys.
X The horizontal position, in logical
coordinates, from the left or top
edge of the page where the mouse
was pressed.
Y The vertical position, in logical
coordinates, from the left or top
edge of the page where the mouse
was pressed.
Settings
The settings for Button are:
Value Description
1 The left button was pressed.
2 The right button was pressed.
4 The middle button was pressed.
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
3 SHIFT and CTRL were pressed.
4 ALT was pressed.
5 ALT and SHIFT were pressed.
6 ALT and CTRL were pressed.
7 ALT, SHIFT, and CTRL were
pressed.
Remarks
Mouse events are sent to the selected object
first. If there is no event script tied to the
selected object, then the event is sent to the
object’s container (group or page).
MouseUp Event
Occurs when the user releases any of the
mouse keys.
Syntax
object_MouseUp(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Double,
ByVal Y As Double)
Properties
The MouseUp event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Button An integer value that identifies
which mouse button was pressed.
Shift The state of the SHIFT, CTRL,
and ALT keys.
X The horizontal position, in logical
coordinates, from the left or top
edge of the page where the mouse
was pressed.
Y The vertical position, in logical
coordinates, from the left or top
edge of the page where the mouse
was pressed.
Settings
The settings for Button are:
Value Description
1 The left button was pressed.
2 The right button was pressed.
4 The middle button was pressed.
The settings for Shift are:
Value Description
1 SHIFT was pressed.
2 CTRL was pressed.
3 SHIFT and CTRL were pressed.
4 ALT was pressed.
5 ALT and SHIFT were pressed.
6 ALT and CTRL were pressed.
7 ALT, SHIFT, and CTRL were
pressed.
Remarks
The sequence of mouse-related events is:
• MouseDown
• MouseUp
• Click
• DblClick
MouseDown or MouseUp event procedures
specify actions that occur when a mouse button
is pressed or released. They enable you to
distinguish between the left, right, and middle
mouse buttons. You can also write code for
mouse-keyboard combinations that use the
SHIFT, CTRL, and ALT keyboard modifiers.
Use the Shift argument to identify the state of
the SHIFT, CTRL, and ALT keys when the
MouseDown or MouseUp event occurred. For
example, if both CTRL and ALT are pressed,
the value of Shift is 6.
Mouse events are sent to the selected object
first. If there is no event script tied to the
selected object, then the event is sent to the
object’s container (group or page).
MouseUpOffObject Event
Occurs when the left mouse button is pressed
on an object, the mouse cursor is moved off
the object and then released to the UP position.
Syntax
object_MouseUpOffObject()
Properties
The MouseUpOffObject event syntax has one
part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
The MouseUpOffObject event is only used
with the left mouse button. This event will not
apply to the right mouse button.
The MouseUpOffObject event can be enabled
or disabled by the setting of the
AllowMouseUpOffObjectEvent entry in the
[AppRunPreferences] section of the
[Link] file. The values of the
setting can be 1 for TRUE and 0 for FALSE.
The default value is 1 (TRUE).
If the MouseUpOffObject event is enabled
and there is MouseUpOffObject event script
created for the object, then the
MouseUpOffObject event is processed and
the script in the event is executed. If
MouseUpOffObject event is NOT enabled,
then the MouseUp event is sent to the object’s
container (group or page).
NewAlarm Event
Occurs when a new alarm is detected after the
initial receipt of alarms by the Alarm
Summary object. By default, this event does
not fire. To trigger the event when information
in the Alarm Summary object changes, set
the CheckForNewAlarms property to TRUE.
The event occurs even if the change in content
happens off screen.
For example, in run mode, if a tag goes into a
HI alarm and then changes to HIHI, the
NewAlarm event fires once, unless the
previous HI alarm is acknowledged. The
NewAlarm event detects if an alarm is new,
not a new severity. If you want to detect a
change in severity, use the
CheckForSeverityIncrease property and
SeverityIncreased event.
Syntax
object_NewAlarm(strNode As String, strTag
As String)
Properties
The NewAlarm event syntax has these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
strNode String. A list of nodes with new
alarms. Example of parsing the
list
StrTag String. A list of tags with new
alarms. Example of parsing the
list
Remarks
Whenever you change the filter or sort
configuration, the Alarm Summary object
updates its list of alarm. However, this change
does not cause the NewAlarm event to occur.
If a tag is in alarm and another alarm occurs
for this tag, the NewAlarm event does not
trigger again. For example, if a tag is in HI
alarm and it goes to HIHI alarm the
NewAlarm event fires only once. In order for
the event to trigger twice, the HI alarm would
have to be acknowledged and return to an OK
alarm state prior to the tag going into a HIHI
alarm.
O-Z
OnChange Event
Occurs when the CurrentValue of the
specified Variable object is changed.
Syntax
object_OnChange( )
Properties
The OnChange event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
OnChartFull Event
Occurs when the data for a Chart object
scrolls all the way to the right and hits the
edge. This event can only occur if the
ScrollDirection property of the Chart is set to
LeftToRight.
Syntax
object_OnChartFull( )
Properties
The OnChartFull event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
This event is useful for handling the
appropriate UI action when the data fills up the
Chart. Possible options are to clear the data
and change the start time to now, effectively
wiping out the Chart, or to scroll the Chart
over 50%.
OnChartRefresh Event
Occurs when the Chart object's data
automatically scrolls. The event occurs at an
interval defined by the RefreshRate property.
Syntax
object_OnChartRefresh( )
Properties
The OnChartRefresh event syntax has this
part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
OnFalse Event
Occurs when an expression in an Event object
changes from True to False (non-zero to
zero).
Syntax
object_OnFalse( )
Properties
The OnFalse event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
When using an expression such as AI1 > 55.0,
the value of this expression is 0 when AI1 is
less than or equal to 55.0. When AI1 exceeds
55.0 the value of the expression is 1. The
OnFalse event is triggered when the value of
the expression changes from 1 to 0. If the
expression is a single tag, then the value of the
tag is evaluated as either 0.0 or non-zero to
determine whether to fire the event.
See the complete event firing event transition
described in the DataChange event.
OnPenSelect Event
Occurs when the user changes the currently
active Pen by selecting another Pen.
Syntax
object_OnPenSelect(ByVal IPenNum As
Long)
Properties
The OnPenSelect event syntax has these parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
IPenNum The index in the Pens
collection that defines the
selected Pen.
OnTimeOut Event
Occurs depending on the TriggerType of the
Timer:
OneShot - The event is fired at the StartTime.
Continuous - The event is fired at the
StartTime and then at the interval
specified for the Interval property.
Daily - The event is fired at the StartTime for
those days that have been configured (see
DaysOfWeek).
Monthly - The event is fired at the StartTime
for every day that has been configured (see
DaysOfMonth).
Syntax
object_OnTimeOut(ByVal lTimerId As
Long)
Properties
The OnTimeOut event syntax has these parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
lTimerId Reserved.
OnTrue Event
Occurs when an expression in an Event object
changes from False to True (zero to non-
zero).
Syntax
object_OnTrue( )
Properties
The OnTrue event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
When using an expression such as AI1 > 55.0,
the value of this expression is 0 when AI1 is
less than or equal to 55.0. When AI1 exceeds
55.0 the value of the expression is 1. The
OnTrue event is triggered when the value of
the expression changes from 0 to 1. If the
expression is a single tag, then the value of the
tag is evaluated as either 0.0 or non-zero to
determine whether to fire the event.
See the complete event firing event transition
described in the DataChange event.
RMouseClick Event
Occurs when the user clicks the right mouse
button on the Alarm Summary object in
either the Configuration or Run-time
environment.
Syntax
object_RMouseClick(ByVal Col As Long,
ByVal Row As Long, ByVal x As Long,
ByVal y As Long)
Properties
The RMouseClick event syntax has these
parts:
Part Description
Object An object expression that
evaluates to an object in the
Applies To list.
Col The column the user clicked on.
Row The row the user clicked on.
X The horizontal location of the
click in device coordinates.
Y The vertical location of the click
in device coordinates.
SelectionChanged Event
Reserved for internal purposes.
SeverityIncreased Event
Occurs when an alarm’s status increases in
severity. The CheckForSeverityIncrease
property must set to TRUE to allow this event
to be triggered. The
CheckForSeverityIncrease property must be
set in run mode. The value you enter here is
not persisted. In other words, when you switch
from run mode to configure mode, the value
changes back to FALSE (0), which is the
default. If you enter TRUE (1) in configure
mode, it switches back to FALSE (0) when
you enter run mode. You must set this value in
run mode.
Syntax
object_SeverityIncreased( )
Properties
The SeverityIncreased event syntax has this
part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
UIDeactivate Event
Reserved for internal purposes.
WhileFalse Event
Occurs in the Event object, while the value is
zero. This event is continually called back at
an interval specified by the Interval property
of the Event object.
Syntax
object_WhileFalse( )
Properties
The WhileFalse event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
See the complete event firing event transition
described in the DataChange event.
WhileTrue Event
Occurs in the Event object, while the value is
non-zero. This event is continually called back
at an interval specified by the Interval
property of the Event object.
Syntax
object_WhileTrue( )
Properties
The WhileTrue event syntax has this part:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
Remarks
See the complete event firing event transition
described in the DataChange event.
Subroutines
A-F
AcknowledgeAllAlarms Subroutine
Acknowledges alarms for all tags in the
specified Picture. If any of the alarms in the
picture require an electronic signature,
acknowledgement depends on the setting of
the Unsigned Writes options in each alarm’s
block:
Accept Enabled – The subroutine will also
acknowledge the alarm associated with
this block.
Reject Enabled – The subroutine will
acknowledge other alarms, but not the
alarm associated with this block.
Syntax
AcknowledgeAllAlarms [Picture],
[intErrorMode]
Properties
The AcknowledgeAllAlarms subroutine
syntax has these parts:
Part Description
Picture String. (Optional) The file
name of the Picture for
which you want to
acknowledge all alarms. If
no picture is specified, the
current picture is used.
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
1 – Allows the user to
handle the error messages.
Errors in the subroutines
are passed back to the
calling routine for
handling.
2 – Writes errors to all
destinations. No error
messages display. Instead,
the errors are written to
all iFIX destinations,
including the Alarm
History window
destinations using
SendOperatorMessage.
Remarks
If the only object in a picture is an Alarm
Summary object that has Allow Acknowledge
All Alarms disabled, this subroutine will not
acknowledge any alarms. The order of logic in
the subroutine is as follows:
1. Look for an Alarm Summary Object in
the picture.
2. Check for whether the Allow
Acknowledge All Alarms option is
enabled.
• If enabled, run the
AckAllAlarms method.
• If disabled, go to next step.
3. Check the other objects in the picture.
If you are using the AcknowledgeAllAlarms
subroutine on an Alarm Summary OCX, this
subroutine checks to ensure that the Allow
Acknowledge All Alarms property is enabled.
If the property is disabled, no alarms
associated with that Alarm Summary OCX are
acknowledged.
AcknowledgeAnAlarm Subroutine
Acknowledges new alarms for the specified
block.
Syntax
AcknowledgeAnAlarm [DataPoint],
[intErrorMode]
Properties
The AcknowledgeAnAlarm subroutine syntax
has these parts:
Part Description
DataPoint String. (Optional) The name of the database
block for which you want to acknowledge
alarms. If no block is specified, alarms for
the database block associated with the
selected object are acknowledged.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If
no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the errors
are written to all iFIX destinations,
including the Alarm History window
destinations using SendOperatorMessage.
AlarmHornEnabled Subroutine
Gets or sets the alarm horn enabled status.
Syntax
AlarmHornEnabled ([blnNewValue],
[intErrorMode])
Properties
The AlarmHornEnabled subroutine syntax
has these parts:
Part Description
blnNewValue Boolean. (Optional). The
value to which you want
to set the alarm horn
enable property.
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Errors are
displayed in the form of a
message box.
1 – Errors are not handled
so that they can be
handled in the calling
routine.
2 – Errors are dispatched
to the alarm destinations
using
SendOperatorMessage.
Return Value
Boolean. The status of the AlarmHornEnable
after the call is completed.
True = The horn will sound on any new alarm.
False = The horn will not sound for any new
alarms.
AlarmHornEnabledToggle Subroutine
Toggles the system’s AlarmHornEnabled
status.
Syntax
AlarmHornEnabledToggle ([intErrorMode])
Properties
The AlarmHornEnabledToggle subroutine
syntax has this part:
Part Description
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Errors are
displayed in the form of a
message box.
1 – Errors are not handled
so that they can be
handled in the calling
routine.
2 – Errors are dispatched
to the alarm destinations
using
SendOperatorMessage.
Return Value
Boolean. The status of the AlarmHornEnable
after the call is completed.
True = The status was toggled to True. The
horn will sound on any new alarm.
False = The status was toggled to False. The
horn will not sound for any new alarms.
AlarmHornSilence Subroutine
Silences the alarm horn.
Syntax
AlarmHornSilence ([intErrorMode])
Properties
The AlarmHornSilence subroutine syntax has
this part:
Part Description
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Errors are
displayed in the form of a
message box.
1 – Errors are not handled
so that they can be
handled in the calling
routine.
2 – Errors are dispatched
to the alarm destinations
using
SendOperatorMessage.
Remarks
The alarm horn must be enabled for this to
work. If you call this routine and the alarm
horn is disabled, no error will be reported.
If a new alarm comes in after this routine is
called, the alarm horn will sound again. When
alarms come in at a rapid rate, it may seem as
though the AlarmHornSilence subroutine is not
working because the new alarms keep
retriggering the horn.
CloseDigitalPoint Subroutine
Closes, or sends a value of 1, to the specified
digital block.
Syntax
CloseDigitalPoint [DigitalPoint],
[intErrorMode]
Properties
The CloseDigitalPoint subroutine syntax has
these parts:
Part Description
DigitalPoint String. (Optional). The name of the digital
block that you want to close. If no block
is specified, it closes the digital point
associated with the selected object.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If
no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the errors
are written to all iFIX destinations,
including the Alarm History window
destinations using SendOperatorMessage.
Remarks
If no block is specified and the selected object
does not have an associated digital point, an
error message appears informing the user that
the write was not successful.
ClosePicture Subroutine
Closes the specified Picture. If there are
multiple instances of a picture open, all
instances of that picture are closed. If a
different alias is assigned to each instance, you
can close one instance using an alias.
Syntax
ClosePicture [Picture], [intErrorMode]
Properties
The ClosePicture subroutine syntax has these
parts:
Part Description
Picture String. (Optional). The
file name or alias of the
picture you want to close.
If no file name is
specified, the currently
active picture is closed.
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
Remarks
If possible, always make this call the last line
in your script. Note that when the
ClosePicture subroutine is used, and the
document being closed is the document that
contains the script, the call must be the last line
in the script. Otherwise, you may experience
unexpected behavior when executing the
script.
If the ClosePicture subroutine is not called
from the picture being closed and is not the last
line in your script, be certain that the operation
is complete before the rest of the script
continues to execute. Immediately after
making the call, you must relinquish the CPU
by calling DoEvents. For example, the
following sample scripts close a picture called
TANK1 and opens a picture called TANK2:
Private Sub Rect1_Click()
ClosePicture “Tank1”
DoEvents
OpenPicture “Tank2”
End Sub
NOTE: You cannot call methods on pictures that
you have closed.
DisableAlarm Subroutine
Disables alarm limit checking for the specified
block.
Syntax
DisableAlarm [DataPoint], [intErrorMode]
Properties
The DisableAlarm subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional) The
name of the database
block for which you want
to disable alarming. If no
block is specified,
alarming is disabled for
the block associated with
the selected object.
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
1 – Allows the user to
handle the error messages.
Errors in the subroutines
are passed back to the
calling routine for
handling.
2 – Writes errors to all
destinations. No error
messages display. Instead,
the errors are written to all
iFIX destinations,
including the Alarm
History window
destinations using
SendOperatorMessage.
EnableAlarm Subroutine
Enables alarm limit checking for the specified
block.
Syntax
EnableAlarm [DataPoint], [intErrorMode]
Properties
The EnableAlarm subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional). The
name of the database
block for which you want
to enable alarming. If no
block is specified,
alarming is enabled for
the database block
associated with the
selected object.
intErrorMode Integer. (Optional). The
error mode.
0 - (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
1 – Allows the user to
handle the error messages.
Errors in the subroutines
are passed back to the
calling routine for
handling.
2 – Writes errors to all
destinations. No error
messages display. Instead,
the errors are written to all
iFIX destinations,
including the Alarm
History window
destinations using
SendOperatorMessage.
FetchLimits Subroutine
Returns the High and Low EGUs of the
specified data source.
Syntax
FetchLimits DataSource, HiLimit, LoLimit,
ret, [intErrorMode]
Properties
The FetchLimits subroutine syntax has these
parts:
Part Description
DataSource String. The string name for the
data source. For example,
[Link].AI1.F_CV
HiLimit Single. Returns the high EGU
limit for the data source.
LoLimit Single. Returns the low EGU
limit for the data source.
ret Integer. Returns the status of
the call:
0 = Successful
1 = Syntax error
2 = Data source does not exist
3 = Data type mismatch
intErrorMode Integer. (Optional). The error
mode.
0 (default) – Allows the
subroutines to provide the error
messages. Errors are displayed
in the form of a message box. If
no entry is made for the
intErrorMode parameter, the
default is used.
1 – Allows the user to handle
the error messages. Errors in
the subroutines are passed back
to the calling routine for
handling.
3 – Writes errors to all
destinations. No error messages
display. Instead, the errors are
written to all iFIX destinations,
including the Alarm History
window destinations using
SendOperatorMessage.
FindDataSource Subroutine
Returns the string name of the data source that
is connected to a property of the specified
object if the data source is an iFIX database tag
or animation object.
Syntax
FindDataSource (Object, [strProperty])
Properties
The FindDataSource function syntax has
these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
strProperty String. (Optional). The
property connected to the
data source. If no property is
specified, the function
returns the connection to the
first property if finds that is
connected to a data source.
Return Value
String. The string name of the data source
object.
Remarks
This function does not return a value for items
within groups. For example, if you have a
group of data links all connected to different
data sources but, the group itself is not
connected to a data source, this function will
return an empty string. It only returns the name
of the data source that is connected to the
object you pass in for the Object parameter.
FindLocalObject Subroutine
Finds an object inside a group based on the
object’s partial name. The group could be a
Picture, DynamoSet or a Group of shapes.
Syntax
FindLocalObject (StartObject, PartialName)
Properties
The FindLocalObject subroutine syntax has
these parts:
Part Description
StartObject Object. The name of the
Picture or Group where
the object you are looking
for is contained.
PartialName String. A partial name for
the object to be found. For
example, if the object’s full
name is PipeColorAnim1,
you can pass in
“PipeColorA”, or “PipeC”.
Return Value
Object. The first object in the Group whose
name contains what is entered for
PartialName.
Remarks
For example, if, through scripting, you want to
get an object inside a Group in order to
animate that particular object’s vertical fill, use
FindLocalObject with the group’s name and
just a partial name of the object to fill.
FindLocalObject is typically used for
Dynamo sets where a Dynamo objects share
common names for all of their contained
objects - the only difference being the numeric
ending. Forms and subroutines that call this
subroutine make use of the partial name to
operate on all similar Dynamo objects so that
all similar Dynamo objects in a picture can use
the same subroutines and forms. This assumes
that user creating the Dynamo objects uses a
naming convention for the objects inside of the
Dynamo object.
G-I
GeneratePicture Subroutine
Creates a new Picture.
Syntax
GeneratePicture (aPicInfo)
Properties
The GeneratePicture subroutine syntax has
this part:
Part Description
aPicInfo The PictureInfo structure
specifies the properties of the
picture to be generated.
The members of the PictureInfo structure are
as follows:
Member Description
lfTopPct The preferred top
window edge location
of the picture being
generated. The location
Unit, pixel or percent,
is determined by
bPixels. Type is
Double.
lfLeftPct The preferred left
window edge location
of the picture being
generated. The location
Unit, pixel or percent,
is determined by
bPixels. Type is
Double.
lfHeightPct The preferred window
height of the picture
being generated. The
dimension Unit, pixel
or percent, is
determined by bPixels.
Type is Double.
lfWidthPct The preferred window
width of the picture
being generated. The
dimension Unit, pixel
or percent, is
determined by bPixels.
Type is Double.
lBkColor Color for background
color of the picture.
Type is Long.
szName The name of the
picture. Type is String.
bPixels Determines whether
the window location
units are pixel or
percent. Type is
Boolean.
bTitlebar Defines whether or not
the picture window has
a title bar. Type is
Boolean.
bSystemMenu Defines whether or not
the picture window has
a system menu. Type is
Boolean.
bResizable Defines whether or not
the picture window is
resizable. Type is
Boolean.
bAlwaysOnTop Defines whether or not
the picture window is
always on top of other
picture windows. Type
is Boolean.
bRuntimeVisible Defines whether or not
the picture is visible at
run time. Type is
Boolean.
GetAllConnections Subroutine
Retrieves all data blocks connected to objects
in a Picture or in a Group.
Syntax
GetAllConnections (Obj)
Properties
The GetAllConnections subroutine syntax has
this part:
Part Description
Obj Object. Usually the page object
that represents the Picture whose
connections you want to retrieve.
This can also be a Group object.
Return Value
Collection. The Collection of all the fully
qualified names of database items in the
Picture. These items can be either data links or
data items that animate objects.
GetDecimalSeparator Subroutine
Reserved method used internally for Experts.
Syntax
GetDecimalSeparator ([intErrorMode])
Properties
The GetDecimalSeparator subroutine syntax
has this part:
Part Description
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines
to provide the error messages. Errors
are displayed in the form of a
message box. If no entry is made for
the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
GetFormDynamoColor Subroutine
Reserved method used internally for iFIX
Dynamos.
Syntax
GetFormDynamoColor DynColor
GetFormNumeric Subroutine
Reserved method used internally for Experts.
Syntax
GetFormNumeric ()
GetFormPushbutton Subroutine
Reserved method used internally for Experts.
Syntax
GetFormPushbutton ()
GetFormRamp Subroutine
Reserved method used internally for Experts.
Syntax
GetFormRamp ()
GetFormSlider Subroutine
Reserved method used internally for Experts.
Syntax
GetFormSlider ()
GetLocaleInfoA Subroutine
Retrieves information relating to a specific
locale.
Syntax
GetLocaleInfoA (Locale, LCType, lpLCData,
cchData)
Properties
The GetLocaleInfoA subroutine syntax has
these parts:
Part Description
Locale Long. The locale ID from where you
want to get information.
LCType Long. The type of information to
retrieve. Refer to the [Link] file for
constants with the LOCALE_ prefix.
lpLCData String. Buffer to load with the
information. Make sure this string is
initialized to the appropriate length.
cchData Long. The length of the lpLCData
buffer, or zero to get the buffer length.
Return Value
Long. The number of characters loaded into
the buffer. Zero on error.
Remarks
GetLocaleInfoA is a Windows API call.
GetUserDefaultLCID Subroutine
Retrieves the default locale for the current
user.
Syntax
GetUserDefaultLCID ()
Return Value
Long. The default locale ID for the current
user.
Remarks
GetUserDefaultLCID is a Windows API call.
HandleError Subroutine
The global error handler routine. It displays the
error number and its description when an error
occurs.
Syntax
HandleError([intErrorMode])
Properties
The HandleError subroutine syntax has this
part:
Part Description
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines
to provide the error messages.
Errors are displayed in the form of a
message box. If no entry is made
for the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all
destinations. No error messages
display. Instead, the errors are
written to all iFIX destinations,
including the Alarm History
window destinations using
SendOperatorMessage.
IsUserFxg Subroutine
Determines whether the active document is the
[Link].
Syntax
IsUserFxg ()
Return Value
Boolean. True if the active picture is the
[Link]. False if it is not.
Remarks
This subroutine is useful when cycling through
the collection of open Documents. Typically,
a user would not want to perform the same
actions that you do on [Link] that he/she
would on a picture or schedule. Thus, if
IsUserFxg returns True, the user can write
their code to skip [Link].
L-R
LocateObject Subroutine
Searches a Picture for the specified object and
selects the object.
Syntax
LocateObject LinkName, bRelative,
[intErrorMode]
Properties
The LocateObject subroutine syntax has these
parts:
Part Description
LinkName String. The name of the
object for which you want
to search.
bRelative Boolean. If True, the
current picture is
searched; if False, all
open pictures are
searched.
intErrorMode Integer. (Optional). The
error mode.
0 (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
2 – Allows the user to
handle the error messages.
Errors in the subroutines
are passed back to the
calling routine for
handling.
3 – Writes errors to all
destinations. No error
messages display. Instead,
the errors are written to all
iFIX destinations,
including the Alarm
History window
destinations using
SendOperatorMessage.
LogIn Subroutine
The LogIn subroutine:
• Executes the standard Login program.
• Logs out the current user upon
accepting a new login and saves the
current user information which is
restored after the execution of a
subsequent Login subroutine.
• Updates the user ID information so
that all operator messages and SCADA
node security checking reflects the
correct user.
Syntax
LogIn([intErrorMode])([bPushCurrentUser
As Boolean])
Properties
The LogIn subroutine syntax has these parts:
Part Description
intErrorMo Integer. (Optional). The error mode.
de 0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box.
If no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
bPushCurr Boolean. (Optional).
entUser False (default) – By default, this feature
is disabled.
True – Pushes the current user (UserA)
to the stack when logging in a new user
(UserB). This parameter allows you to
logout UserA after accepting the UserB
login but saves the UserA information.
The saved information is restored after
the execution of a subsequent LogOut
subroutine.
OffScan Subroutine
Places the specified block off scan.
Syntax
OffScan [DataPoint], [intErrorMode]
Properties
The OffScan subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional). The name of the
database block that you want to turn
off scan. If no block is specified,
the database block for the selected
object is turned off scan.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines
to provide the error messages.
Errors are displayed in the form of a
message box. If no entry is made
for the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
OnScan Subroutine
Places the specified block on scan.
Syntax
OnScan [DataPoint], [intErrorMode]
Properties
The OnScan subroutine syntax has these parts:
Part Description
DataPoint String. (Optional). The name of the
database block that you want to put on
scan. If you do not specify a name, the
database block for the selected object
is put on scan.
intErrorM Integer. (Optional). The error mode.
ode 0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message
box. If no entry is made for the
intErrorMode parameter, the default is
used.
1 – Allows the user to handle the error
messages. Errors in the subroutines
are passed back to the calling routine
for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
OpenDigitalPoint Subroutine
Opens, or sends a value of 0, to the specified
digital block.
Syntax
OpenDigitalPoint [DigitalPoint],
[intErrorMode]
Properties
The OpenDigitalPoint subroutine syntax has
these parts:
Part Description
DigitalPoint String. (Optional). The name of the
digital block that you want to open. If no
block is specified, it opens the digital
point associated with the selected object.
bstrEventName Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box.
If no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
Remarks
If no block is specified and the selected object
does not have an associated digital point, an
error message will occur informing the user
that the write was not successful.
OpenPicture Subroutine
Opens the specified Picture.
Syntax
OpenPicture [Picture], [PictureAlias],
[TopPosition], [LeftPosition], [intErrorMode],
[CallingPicture], [TSPicType], [TagList],
[bNewInstance]
Properties
The OpenPicture subroutine syntax has these
parts:
Part Description
Picture String. (Optional) The file
name of the Picture you
want to open. If no file
name is specified, the
Open dialog is launched
allowing the user to select
a picture to open.
PictureAlias String. (Optional) The
alias that you want to
assign to the Picture.
TopPosition Variant. (Optional) The
position at which you
want to place the top of
the Picture. Default = 0.
LeftPosition Variant. (Optional) The
position at which you
want to place the left side
of the Picture. Default =
0.
intErrorMode Integer. (Optional) The
error mode.
0 (default) – Allows the
subroutines to provide the
error messages. Errors are
displayed in the form of a
message box. If no entry
is made for the
intErrorMode parameter,
the default is used.
1 – Allows the user to
handle the error
messages. Errors in the
subroutines are passed
back to the calling routine
for handling.
2 – Writes errors to all
destinations. No error
messages display. Instead,
the errors are written to
all iFIX destinations,
including the Alarm
History window
destinations using
SendOperatorMessage.
Calling Object. (Optional) The
Picture picture whose tag status
functionality will be
accessed.
TSPicType TS_PIC_TYPE
(Optional) The type of
Tag Status picture to
open:
0 – Single Tag TS picture
1 – Quick Trend
2 – Tag Control Panel
TagList Variant. (Optional) An
array of strings to be used
in the tag status picture.
bNewInstance Boolean. (Optional)
Describes whether the
picture is a new instance.
This field is useful when
opening multiple pictures.
True – Opens a new
instance of the same
picture.
False – Does not open a
new instance of the
picture. This is the default
setting.
Remarks
The alias is a user-defined generic picture
name. By using aliases, you can control the
opening and closing of multiple pictures
without concern for the currently displayed
picture.
Tag status functionality is available only when
no Picture string has been provided and if the
CallingPicture and TSPicType parameters are
provided.
If the CallingPicture parameter is not provided,
the call to OpenPicture is treated as a regular
OpenPicture request. If the CallingPicture
parameter is provided, but the TSPicType
parameter is not, the call to OpenPicture
generates an error message.
If a string has been provided via the Picture
parameter, the standard OpenPicture
functionality is invoked. In this case, the
CallingPicture, TSPicType, and TagList
parameters are ignored.
In run mode, you can modify the VBA
scripting in a new instance of a picture.
However, modifications to scripts in an
instance of a picture will not be saved. Saving
changes to scripts in run mode is not allowed.
To make changes to a script in the main
picture, switch to configure mode and edit the
script in the main picture (not the instance).
OpenTGDPicture Subroutine
Opens the specified Picture with the specified
tag group file.
Syntax
OpenTGDPicture [Picture], [PictureAlias],
[TopPosition], [LeftPosition],
[TagGroupName], [intErrorMode],
[bNewInstance]
Properties
The OpenTGDPicture subroutine syntax has
these parts:
Part Description
Picture String. (Optional) The file name of
the Picture you want to open. If no
file name is specified, the Open
dialog is launched allowing the user
to select a picture to open.
PictureAlias String. (Optional) The alias that you
want to assign to the Picture.
Part Description
TopPosition Variant. (Optional) The position at
which you want to place the top of
the Picture. Default = 0.
LeftPosition Variant. (Optional) The position at
which you want to place the left
side of the Picture. Default = 0.
TagGroupNa String (Optional) The tag group file
me name. Do not specify a path for this
parameter.
Part Description
intErrorMode Integer. (Optional) The error mode.
0 (default) – Allows the subroutines
to provide the error messages.
Errors are displayed in the form of a
message box. If no entry is made for
the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
Part Description
bNewInstance Boolean. (Optional) Describes
whether the picture is a new
instance. This field is useful when
opening multiple pictures.
True – Opens a new instance of the
same picture.
False – Does not open a new
instance of the picture. This is the
default setting.
Remarks
The alias is a user-defined generic picture
name. By using aliases, you can control the
opening and closing of multiple pictures
without concern for the currently displayed
picture.
In run mode, you can modify the VBA
scripting in a new instance of a picture.
However, modifications to scripts in an
instance of a picture will not be saved. Saving
changes to scripts in run mode is not allowed.
To make changes to a script in the main
picture, switch to configure mode and edit the
script in the main picture (not the instance).
PictureAlias Subroutine
Assigns an alias, or nickname, to the current
Picture.
Syntax
PictureAlias PictureAlias, [intErrorMode]
Properties
The PictureAlias subroutine syntax has these
parts:
Part Description
PictureAlias String. The alias that you want to
assign to the current picture.
intErrorMode Integer. (Optional). The error
mode.
0 (default) – Allows the
subroutines to provide the error
messages. Errors are displayed in
the form of a message box. If no
entry is made for the
intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to
the calling routine for handling.
2 – Writes errors to all
destinations. No error messages
display. Instead, the errors are
written to all iFIX destinations,
including the Alarm History
window destinations using
SendOperatorMessage.
PrintReport Subroutine
Prints the specified Crystal Report.
Syntax
PrintReport Report,
[Prompt],[Copies],[Coll],[StartNo],[EndNo],
[intErrorMode]
Properties
The PrintReport subroutine syntax has these
parts:
Part Description
Report String. The name of the report to print,
including the file’s full path.
Prompt Boolean. (Optional) If True, the user is
prompted with the open report dialog,
allowing the user to select the report to
print. If False, the report specified is
printed. This option is ignored in Crystal
XI.
Copies Long. (Optional) The number of copies to
print. Default = 1. This option is ignored
in Crystal XI.
Coll Boolean. (Optional) If True, the reports
are collated. If False, they are not. This
option is ignored in Crystal XI.
Part Description
StartNo Long. (Optional) The first page of the
report to print. This option is ignored in
Crystal XI.
EndNo Long. (Optional) The last page of the
report to print. This option is ignored in
Crystal XI.
Part Description
intErro Integer. (Optional). The error mode. This
rMode option is ignored in Crystal XI.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If
no entry is made for the intErrorMode
parameter, the default is used.
1 - Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the errors
are written to all iFIX destinations,
including the Alarm History window
destinations using SendOperatorMessage.
QuickAdd Subroutine
Launches the Quick Add dialog box for adding
a data block.
Syntax
QuickAdd (DataSource, [intErrorMode])
Properties
The QuickAdd subroutine syntax has these
parts:
Part Description
DataSource String. The name of the database
block you want to add.
intErrorMode Integer. (Optional). The error
mode.
0 (default) – Allows the
subroutines to provide the error
messages. Errors are displayed in
the form of a message box. If no
entry is made for the
intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to
the calling routine for handling.
2 – Writes errors to all
destinations. No error messages
display. Instead, the errors are
written to all iFIX destinations,
including the Alarm History
window destinations using
SendOperatorMessage.
Return Value
Integer. The status of the database block.
0 = OK (data block already exists)
1 = Invalid Syntax
2 = Undefined (Quick Add dialog is launched)
3 = Data Type Mismatch
4 = User chose Use Anyway
5 = User chose not to add the block
RampValue Subroutine
Manually ramps the specified database block
by increasing or decreasing its current value by
a specified percentage of the engineering units
(EGU) range.
Syntax
RampValue RampValue, ByPercent,
[DataPoint], [intErrorMode]
Properties
The RampValue subroutine syntax has these
parts:
Part Description
RampValue String. The value you want to use to
ramp the database block.
ByPercent Boolean. If True, the block is
ramped by the percentage of the
EGU range. If False, the data point
is ramped by the RampValue.
DataPoint String. (Optional). The name of the
database block that you want to
ramp. If no block is specified, the
value of the data source associated
with the selected object is ramped.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines
to provide the error messages. Errors
are displayed in the form of a
message box. If no entry is made for
the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
ReadValue Subroutine
Reads the value of the specified block.
Syntax
ReadValue [DataPoint], [intErrorMode]
Properties
The ReadValue subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional). The database
block that you want to read. If no
block is specified, the data source
associated with the selected object
is read.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines
to provide the error messages.
Errors are displayed in the form of a
message box. If no entry is made
for the intErrorMode parameter, the
default is used.
1 – Allows the user to handle the
error messages. Errors in the
subroutines are passed back to the
calling routine for handling.
2 – Writes errors to all destinations.
No error messages display. Instead,
the errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
Return Value
ReadValue returns the value of the specified
block.
RegCloseKey Subroutine
Closes a key in the system registry.
FactoryGlobals provides the Declare statement
in GlobalSubroutines so you can use this
Windows API call without declaring it in your
procedures.
NOTE: For Crystal XI users, use the
PrintReport subroutine instead of using the
RegOpenKeyEx and RegCloseKeyEx
subroutines. The PrintReport subroutine will do
all of the registry entries for you.
Syntax
RegCloseKey (hKey)
Properties
The RegCloseKey subroutine syntax has this
part:
Part Description
hKey Long. The key to close.
Return Value
Long. Zero on success. All other values
indicate an error.
Remarks
RegCloseKey is a Windows API call.
RegOpenKeyEx Subroutine
Opens an existing registry key. FactoryGlobals
provides the Declare statement in
GlobalSubroutines so you can use this
Windows API call without declaring it in your
procedures.
NOTE: For Crystal XI users, use the
PrintReport subroutine instead of using the
RegOpenKeyEx and RegCloseKeyEx
subroutines. The PrintReport subroutine will do
all of the registry entries for you.
Syntax
RegOpenKeyEx (hKey, lpSubKey, ulOptions,
samDesired, phkResult)
Properties
The RegOpenKeyEx subroutine syntax has
these parts:
Part Description
hKey Long. Handle of an open key or one
of the standard key names.
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA
Use the VB5.0 API Viewer to get the
correct hex number for the key.
lpSubKey String. Name of the key to open.
ulOptions Long. Unused. Set to zero.
samDesired Long. One or more constants with the
prefix KEY_ that describes which
operation are allowed for this key.
phkResult
Long. Variable to load with a handle
to the open key.
Return Value
Long. Zero on success. All other values
indicate an error.
Remarks
RegOpenKeyEx is a Windows API call.
ReplacePicture Subroutine
Closes a Picture and replaces it with another
Picture. If a picture with a specified tag group
file is already open in the WorkSpace, another
instance of that picture with the same tag
group file opens in the WorkSpace. The
picture being opened will stretch or skew to fit
the document height and width of the picture
being replaced. The DisableAutoScale setting
does not affect this behavior.
Syntax
ReplacePicture NewPicture, [OldPicture],
[TagGroupFileName], [intErrorMode],
[bShowPictureNotOpenErrors];
[CallingPicture]; [TSPicType]; [TagList];
[bNewInstance]
Properties
The ReplacePicture subroutine syntax has
these parts:
Part Description
NewPicture String. The file name of the Picture
you want to open.
OldPicture String. (Optional) The file name of the
Picture you want to replace. If no
picture is specified, the currently active
picture is replaced.
Part Description
String. (Optional) The file name of the
TagGroupFileN Tag Group File you want to load with
ame the new picture.
Integer. (Optional) The error mode.
intErrorMode 0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message
box. If no entry is made for the
intErrorMode parameter, the default is
used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
Part Description
Boolean. (Optional). If this value is set
bShowPictureN to TRUE, an error displays when the
otOpenErrors picture to be replaced is not open and
no replace occurs. The default is
FALSE.
Object. (Optional) The picture whose
CallingPicture tag status functionality will be
accessed.
TS_PIC_TYPE (Optional) The type of
TSPicType Tag Status picture to open:
0 – Single Tag Status picture
1 – Quick Trend picture
2 – Tag Control Panel picture
Variant. (Optional) An array of strings
TagList to be used in the tag status picture.
Part Description
Boolean. (Optional). Describes
bNewInstance whether the picture is a new instance.
This field is useful when opening
multiple pictures. If the value is set to
TRUE, a new instance of the same
picture is opened. If the value is set to
FALSE, then a new instance of the
picture is not opened. The default is
FALSE.
Remarks
Tag status functionality is available only when
no NewPicture string has been provided and if
the CallingPicture and TSPicType parameters
are provided. If the CallingPicture parameter is
not provided, the call to ReplacePicture is
treated as an invalid ReplacePicture request. If
the CallingPicture parameter is provided, but
the TSPicType parameter is not, the call to
ReplacePicture is treated as an invalid
ReplacePicture request.
If a string has been provided via the
NewPicture parameter, the standard
ReplacePicture functionality is invoked. In this
case the CallingPicture, TSPicType, and
TagList parameters are ignored.
If possible, always make this call the last line
in your script. Note that when the
ReplacePicture subroutine is used, and the
document being replaced is the document that
contains the script, the call must be the last line
in the script. Otherwise, you may experience
unexpected behavior when executing the
script.
If the ReplacePicture subroutine is not in the
picture being replaced and is not the last line in
your script, be certain that the operation is
complete before the rest of the script continues
to execute. Immediately after making the call,
you must relinquish the CPU by calling
DoEvents.
For example, the following sample script
replaces a picture called TANK1 with a picture
called TANK2, then opens another picture
called TANK3:
Private Sub Rect1_Click()
ReplacePicture "Tank2", "Tank1"
DoEvents
OpenPicture "Tank3"
End Sub
ReplaceTGDPicture Subroutine
Closes a Picture and replaces it with another
Picture with the specified tag group file. If a
picture with that specified tag group file is
already open in the WorkSpace, another
instance of that picture with the same tag
group file opens in the WorkSpace.
Syntax
ReplaceTGDPicture NewPicture,
TagGroupName, [OldPicture],
[bNewInstance]
Properties
The ReplaceTGDPicture subroutine syntax
has these parts:
Part Description
NewPicture String. The file name of the Picture
you want to open.
TagGroupName String. Tag group file name. Do not
specify a path.
OldPicture String. (Optional) The file name of the
Picture you want to replace. If no
picture is specified, the currently
active picture is replaced.
bNewInstance Boolean. (Optional). Describes
whether the picture is a new instance.
This field is useful when opening
multiple pictures. If the value is set to
TRUE, a new instance of the same
picture is opened. If the value is set to
FALSE, then a new instance of the
picture is not opened. The default is
FALSE.
Remarks
If possible, always make this call the last line
in your script. Note that when the
ReplaceTGDPicture subroutine is used, and
the document being replaced is the document
that contains the script, the call must be the last
line in the script. Otherwise, you may
experience unexpected behavior when
executing the script.
If the ReplaceTGDPicture subroutine is not in
the picture being replaced and is not the last
line in your script, be certain that the operation
is complete before the rest of the script
continues to execute. Immediately after
making the call, you must relinquish the CPU
by calling DoEvents.
S-Z
SetAuto Subroutine
Sets the specified block to automatic mode.
Syntax
SetAuto [DataPoint], [intErrorMode]
Properties
The SetAuto subroutine syntax has these parts:
Part Description
DataPoint String. (Optional) The name of the
database block that you want to set to
automatic mode. If no block is specified,
the database block associated with the
selected object is set to automatic mode.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If
no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the errors
are written to all iFIX destinations,
including the Alarm History window
destinations using SendOperatorMessage.
SetManual Subroutine
Sets the specified block to manual mode.
Syntax
SetManual [DataPoint], [intErrorMode]
Properties
The SetManual subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional) The name of the
database block that you want to set to
manual mode. If no block is specified,
the database block associated with the
selected object is set to manual mode.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box.
If no entry is made for the
intErrorMode parameter, the default is
used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
ShellExecute Subroutine
Finds the file name of the program that is
associated with a specified file and either runs
the program for the file or prints the file.
FactoryGlobals provides the Declare statement
in GlobalSubroutines so you can use this
Windows API call without declaring it in your
procedures.
Syntax
ShellExecute (hwnd, lpOperation, lpFile,
lpParameters, lpDirectory, nShowCmd)
Properties
The ShellExecute subroutine syntax has these
parts:
Part Description
hwnd Long. A handle to a window.
lpOperation String. The string “Open” to open
the lpFile document or “Print” to
print it. You can use vbNullString
to default to “Open”.
lpFile String. A program name or the
name of a file to print or open using
the associated program.
lpParameters String. A string with parameters to
pass to the exe file if lpszFile is an
executable file. VbNullString if
lpszFile refers to a document file or
if on parameters are used.
lpDirectory String. The full path of the default
directory to use.
nShowCmd Long. A constant value specifying
how to show the launched program.
Return Value
Long. The success of the ShellExecute call. A
value greater than 32 signifies success.
Remarks
ShellExecute is a Windows API call.
ToggleDigitalPoint Subroutine
Toggles the current state of the digital block
between open and closed.
Syntax
ToggleDigitalPoint [DigitalPoint],
[intErrorMode]
Properties
The ToggleDigitalPoint subroutine syntax has
these parts:
Part Description
DigitalPoint String. (Optional). The name of the
digital block that you want to toggle. If
no block is specified, it opens the digital
point associated with the selected object.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box.
If no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
ToggleManual Subroutine
Toggles the mode status of the specified block
between manual and automatic modes.
Syntax
ToggleManual [DataPoint], [intErrorMode]
Properties
The ToggleManual subroutine syntax has
these parts:
Part Description
DataPoint String. (Optional). The name of the
database block whose state you want to
toggle. If no name is specified, the database
block associated with the selected object is
toggled.
intErrorM Integer. (Optional). The error mode.
ode 0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If
no entry is made for the intErrorMode
parameter, the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the errors
are written to all iFIX destinations,
including the Alarm History window
destinations using SendOperatorMessage.
ToggleScan Subroutine
Toggles the scan status of the specified block.
Syntax
ToggleScan [DataPoint], [intErrorMode]
Properties
The ToggleScan subroutine syntax has these
parts:
Part Description
DataPoint String. (Optional). The name of the
database block whose scan status you
want to toggle. If you do not specify a
name, the scan status of the database
block associated with the selected
object is toggled.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box.
If no entry is made for the
intErrorMode parameter, the default is
used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are
passed back to the calling routine for
handling.
2 – Writes errors to all destinations. No
error messages display. Instead, the
errors are written to all iFIX
destinations, including the Alarm
History window destinations using
SendOperatorMessage.
WriteValue Subroutine
Sets the value of the current value of the
specified database block.
Syntax
WriteValue Value , [DataPoint],
[intErrorMode]
Properties
The WriteValue subroutine syntax has these
parts:
Part Description
Value String. The value that you want to write to the
specified database block.
DataPoint String. (Optional). The database block to
which you want to write the specified value.
If no block is specified, the data source
associated with the selected object is write.
intErrorMode Integer. (Optional). The error mode.
0 (default) – Allows the subroutines to
provide the error messages. Errors are
displayed in the form of a message box. If no
entry is made for the intErrorMode parameter,
the default is used.
1 – Allows the user to handle the error
messages. Errors in the subroutines are passed
back to the calling routine for handling.
2 – Writes errors to all destinations. No error
messages display. Instead, the errors are
written to all iFIX destinations, including the
Alarm History window destinations using
SendOperatorMessage.
Database Functions
Database Functions
Summary
The following list contains the iFIX Database
Functions that are available to the Automation
Interface. For information on non iFIX objects,
refer to the appropriate help system.
• eda_add_block
• eda_delete_block
• eda_get_pdb_name
• eda_reload_databse
• eda_save_database
• eda_type_to_index
• FixGetMyName
• NlsGetText
eda_add_block Function
Add a new block of the specified type on the
specified node.
Syntax
Function eda_add_block(NodeName,
TagName, BlkType)
Properties
The eda_add_block function syntax has these
parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
NodeName String. The node name on
which to add the block.
TagName String. The name to identify
the tag (maximum of 30
characters).
BlkType Integer. The block type
index.
Return Value
Integer. FE_OK if data is valid
Remarks
Note that the type is passed as an integer. A
type string such as “AI” can be converted to a
type index by calling the eda_type_to_index
function as listed below. The new tag will be
initialized to the same default values that
appear when a new tag is created with
DatabaseManager. These values can be written
using the various other functions mentioned
here.
eda_delete_block Function
Deletes the specified database block from the
database.
Syntax
Function eda_delete_block (NodeName,
TagName)
Properties
The eda_delete_block function syntax has
these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
NodeName String. The node name on
which to delete the block.
TagName String. The name of the
block to be deleted.
Return Value
FE_OK if successful; FE_XXX if error.
Remarks
Deletes the specified block from the database.
If this block is part of a chain, then the
previous and next blocks of the chain will be
reconnected. It is good practice to place the
block OFFSCAN before deleting it.
eda_get_pdb_name Function
Retrieves the PDB file name from the
database.
Syntax
Function eda_get_pdb_name As Integer
(NodeName, DatabaseName, BufSize)
Properties
The eda_get_pdb_name function syntax has
these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
NodeName String. The name of the
node on which the database
resides.
DatabaseName String. Returns the name of
the database for
NodeName.
BufSize Integer. The maximum
size, in bytes, to return in
DatabaseName.
Return Value
Integer. FE_OK if no error.
Remarks
This is the name of the current PDB file loaded
by the system (for example, by the DBB
RELOAD function or by the
eda_reload_database function). The name is
returned without the path or extension.
The DatabaseName parameter must be
declared either as fixed-length strings of 260
characters or as variable-length strings that are
initialized as 260 characters before calling
eda_get_pdb_name. The NodeName
parameter must be declared either as fixed-
length strings of 9 characters or as variable-
length strings that are initialized as 9
characters before calling eda_get_pdb_name.
For example, you could initialize the
NodeName parameter in either of the
following ways:
Dim NodeName As String * 9
or
Dim NodeName As String
NodeName = " "
eda_reload_database Function
Loads the specified PDB to a file into the
specified node.
Syntax
Function eda_reload_database (NodeName,
DatabaseName)
Properties
The eda_reload_database function syntax has
these parts:
Part Description
object An object expression that evaluates to an
object in the Applies To list.
NodeName String. The name of the node on which
to re-load the database.
DatabaseName String. The name of the database file
that is to be loaded into memory.
Return Value
Integer. FE_OK if no error
Remarks
This is equivalent to the DBB Reload...
function. The name passed becomes the new
name of the database. The name should be
passed without a path or extension.
NOTE: The previous database in memory is
replaced. No check is made to see if the database
has been modified.
eda_save_database Function
Saves the current active database to a file.
Syntax
Function eda_save_database (NodeName,
DatabaseName)
Properties
The eda_save_database function syntax has
these parts:
Part Description
object An object expression that evaluates to an
object in the Applies To list.
NodeName String. The name of the node whose
database is to be saved.
DatabaseName String. The name of the file to which the
current database is to be saved.
Return Value
Long. Some typical errors would be:
Value Description
FE_OK Successful.
FE_SEC_ACCESSS Unauthorized
access
attempted.
FE_BAD_FILENAME DatabaseName
specified is bad.
FE_READ_ONLY Database is read
only.
Remarks
This is equivalent to the DBB Save As...
function. The name passed becomes the new
name of the database. The name should be
passed without a path or extension.
NOTE: This file will only exist on the node
whose database is being saved. This may be
different than the node that is making the
eda_save_database call.
eda_type_to_index Function
Retrieves the type index for the specified string
containing a block type.
Syntax
Function eda_type_to_index (NodeName,
BlockType)
Properties
The eda_type_to_index function syntax has
these parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
NodeName String. Name of node on
which the block is located.
BlockType String. The block type whose
block index is required.
Return Value
Integer. The database block type (a value
between 1 and 150). Returns 0 if the type name
is not recognized.
Remarks
The block index returned by this function
should be used when adding blocks to the
database via the eda_add_block function.
FixGetMyname Function
Get the node name of this node. This function
works whether or not the FIX is running.
Syntax
Function FixGetMyname (Myname, MaxSize)
Properties
The FixGetMyname function syntax has these
parts:
Part Description
object An object expression that evaluates to an
object in the Applies To list.
Myname String. Returns the name of the current
node.
MaxSize Long. The maximum size, in bytes, to
return in Myname.
Return Value
Long.
Value Description
FTK_OK Successful.
FTK_BAD_LENGTH String length too
small.
FTK_NODENAME_NOT No node name
_DEFINED defined for this node.
FTK_BAD_MHANDLE Pointer to non-
writable memory
passed in.
FTK_NO_MESSAGE No message exists for
error.
FTK_BAD_LENGTH String length too
small.
Remarks
The maximum size for MyName (MaxSize) is
NODE_NAME_SIZE.
The MyName parameter must be declared
either as a fixed-length string of 9 characters
before calling FixGetMyName. For example,
initialize the MyName parameter in the
following way:
Dim Myname As String * 9 ‘init
variable
Myname = " " ‘clear variable
before usage
When the length of the Myname string (the
node name) does not fill the maximum size (9
characters), the returned string contains NULL.
To remove the NULL from the VBA string,
you can use the following code snippet:
rtn = FixGetMyname(Myname, 9)
StrMyNode = ""
For i = 1 To Len(Myname)
rtn = Mid(Myname, i, 1)/p>
If Asc(rtn) >= 65 And (Asc(rtn)
<= 95) Then ‘check if I’m Alpha
StrMyNode = StrMyNode & rtn
Else
If Asc(rtn) >= 48 And (Asc(rtn)
<= 57) Then ‘Check if I’m numeric
StrMyNode = StrMyNode & rtn
End If
Next i
In addition, you may want to check for
characters such as the underscore (_) and other
valid characters used in a node name. The
previous example assumes that your node
name only contains the characters A to Z, or
the numbers 1 to 9.
NlsGetText Function
Translates an error number returned as a string.
Syntax
Function NlsGetText (ErrCode, MsgString,
MaxLength)
Properties
The NlsGetText function syntax has these
parts:
Part Description
object An object expression that
evaluates to an object in the
Applies To list.
ErrCode Integer. The error code returned
from a previous eda function
call.
MsgString String. The error message that
corresponds to ErrCode.
MsgString Integer. The maximum size, in
bytes, to return in MsgString.
Return Value
Long.
Part Description
FTK_OK Successful.
FTK_BAD_MHANDLE Pointer to non-
writable
memory passed
in.
FTK_NO_MESSAGE No message
exists for error.
FTK_BAD_LENGTH String length
too small.
Remarks
The Error originates from iFIX. If the message
is longer than specified in MaxLength, then
string will be truncated. If no message exists
for Error, FTK_NO_MESSAGE will be
returned.
The MsgString parameter must be declared as
a fixed-length string of 255 characters before
calling NlsGetText. For example, you
could initialize the MsgString parameter like
so:
Dim MsgString As String * 255
Examples
AboutBox Method Example
The following example opens the Help About
Box for the Alarm Summary object
AlarmSummaryOCX1.
[Link]
AckAlarm Method Example
The following example acknowledges an alarm
generated for the block titled AI1 on a node
titled NODE1 in the Alarm Summary object
AlarmSummaryOCX1.
Dim iRVal as integer
iRVal = [Link]
("NODE1", "AI1")
AckAlarmPage Method Example
The following example acknowledges the
currently displayed page of alarms in the
Alarm Summary object
AlarmSummaryOCX1.
Dim iRVal as integer
iRVal =
[Link]
AckAlarmPageEx Method Example
The following example acknowledges the
currently displayed page of alarms in the
Alarm Summary object
AlarmSummaryOCX1.
[Link]
AckAllAlarms Method Example
The following example acknowledges all
alarms in the Alarm Summary object
AlarmSummaryOCX1.
Dim iRVal as integer
iRVal =
[Link]
AcknowledgeAllAlarms Subroutine
Example
The following example acknowledges alarms
for all blocks for Picture TestPicture.
AcknowledgeAllAlarms
"TestPicture"
AcknowledgeAnAlarm Subroutine
Example
The following example acknowledges alarm
for block AI1.
AcknowledgeAnAlarm "AI1"
ActivateWorkspaceUI Method
Example
The following example activates the
WorkSpace UI.
[Link]
Add Method Example
The following example adds a picture to the
WorkSpace by default.
[Link]
The following example adds a Microsoft Word
Document to the WorkSpace.
[Link]
"[Link]"
The following example adds the subroutine
MySub to Rect1's Procedures collection.
[Link] 1, "Private
Sub MySub(x as integer, y as
integer)"
The following example adds a line of code to
the fifth line in Rect1's first event's event
handler using the Lines collection.
[Link](1).[Link]
d "Msgbox 2", 5
The following example adds a data Group to
the Groups of the FixDataSystem FDS.
[Link] ("DataGroup1")
AddDataSet Method Example
The following example adds a data set named
MySource to an object named
EnhancedChart1. An undefined object can be
accepted as the data source. (True indicates a
UseAnyway condition.)
Dim objDS As Object
Set objDS =
[Link]("[Link].
AI1.F_CV")
AddEventHandler Method Example
The following example adds the event handler
"OpenPicture" to the Click for the object
CurrentObject.
Dim lIndex As Long
[Link]
Handler "Click", "OpenPicture",
lIndex
The resulting procedure is as follows:
private sub CurrentObject_Click()
OpenPicture
end sub
AddImage Method Example
The following example adds the image
CustomButton10 to the Bitmap object Bitmap1
and then displays it by setting it to be the
current image.
[Link] "C:\Program
Files\Proficy\Proficy
iFIX\Local\[Link]"
[Link] =
[Link]
AddLegendItem Method Example
The following example adds the legend item
High Over Range in column 5 of the legend of
Chart object TestChart, displaying 10
characters.
[Link] "High
Over", 5, 10
AddLevel Method Example
The following example adds a level to the
Lookup object Lookup1, using a range
comparison. This level will have an output of
100 for any input value between 10 and 20.
[Link] 10, 100, 20
The following example adds a level to the
Lookup object Lookup1, using an exact match
comparison. For each input of 40, this level
will display an output of 75.
[Link] 40, 75
AddObject Method Example
The following example adds the Oval object
TestOval to the Group TestGroup.
[Link] TestOval
AddPen Method Example
The following example adds a pen to the
Chart Chart1 using a datasource of AI1.
Dim iPen As Object
Set iPen = [Link]("AI1")
AddPictureToStartupList Example
The following example adds a Picture named
[Link] (in the D:\Program
Files\Proficy\Proficy iFIX\PIC directory) to
the Runtime environment's startup list of the
Proficy iFIX WorkSpace.
Dim lErr as Long
lErr =
[Link]
ctureToStartupList_
("D:\Program
Files\Proficy\Proficy
iFIX\pic\[Link]", True)
Note that the full path is required for the
picture. Also note that the second paramater,
when set to TRUE, adds the picture to the
Runtime startup list. When set to FALSE, it
adds the picture to the Configuration
environment's startup list.
AddPoint Method Example
The following example adds a point to the
Polygon object Polygon1.
Dim iPoint as FixFloatPoint
Set iPoint = New FixFloatPoint
iPoint.x = 50.5
iPoint.y = 60.1
[Link] iPoint
AddProcedure Method Example
This example generates the following code in
the ActiveDocument's project:
Public Sub
Rect2_DisplayMessage(strMessage
As String)
MsgBox strMessage
End Sub
Dim o As Object
Dim lIndex As Long
Set o =
[Link].F
indObject("Rect2")
[Link]
"DisplayMessage", "strMessage as
String", _
" MsgBox strMessage", lIndex
AlarmHornEnabled Example
In Example 1, blnReturn contains the status of
the system’s AlarmHornEnabled property
Example 1
Dim blnReturn As Boolean
blnReturn = AlarmHornEnabled
In Example 2, True passed to
enable the alarm horn, then
checks to see if it was set.
Example 2
Dim blnReturn As Boolean
blnReturn =
AlarmHornEnabled(True)
If Not blnReturn Then
MsgBox ("Horn could not be
enabled")
End If
AlarmHornEnabledToggle Example
This example shows how to toggle the alarm
horn and read the return value that indicates
how the status was changed.
Dim blnReturn As Boolean
blnReturn =
AlarmHornEnabledToggle
If blnReturn Then
MsgBox ("The horn is now
Enabled")
Else
MsgBox ("The horn is now
Disabled"
End If
AlarmHornSilence Example
This example silences the alarm horn.
Private Sub Button1_Click ()
AlarmHornSilence
End Sub
Align Method Example
The following example aligns the tops of the
Oval and Polygon objects, Oval1 and
Polygon1.
[Link] False
[Link] False
[Link] 3
ApplyProperty Method Example
Reserved for internal purposes.
AutoScaleDisplayLimits Method
Example
The following example changes the display
limits for all pens in the Chart, Chart1 based
on the range of the data currently in the pens'
data array
[Link]
BringToFront Method Example
The following example selects the Oval object
Oval1 contained within the Picture
TestPicture and brings it to the front of the
stacking order.
[Link]
[Link]
BuildObject Method Example
The following example adds a Rectangle to
the Picture TestPicture.
Dim iRect As Object
Set iRect =
[Link]("Rect")
[Link] = 10.0
[Link] = 30.0
[Link] = 5
[Link] = 1
[Link]
C
CanConstruct Method Example
The following example determines whether the
datasource AI1 for NODE1 has valid syntax for
the Picture TestPicture.
Dim bCanConstruct As Boolean
[Link]
"FIX32.NODE1.AI1", bCanConstruct
CheckAccountExpiration Method
Example
The following example checks the user’s
Windows account expiration status. If the
account expired, this example prompts the user
to change his password (if he has rights to do
so). If the account has not expired, a message
appears stating how many days are left until
the password expires.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim UserName As String
Dim PassWord As String
Dim UsrId As String
Dim bExpired As Boolean
Dim daysLeft As Long
Dim bCanChangePassword As Boolean
'user name of an iFix user using
Windows security
UserName = "expire"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check account status and user’s
right to change password
[Link]
UserName, bExpired,
bCanChangePassword, daysLeft
If bExpired <> False Then
If bCanChangePassword <> False
Then
[Link]
UserName
End If
Else
'password is not expired
MsgBox "Password is due to expire
in " & daysLeft & " days."
End If
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
CheckSecurityEnabled Method
Example
The following example creates the ESignature
Object and checks to see if security is enabled
on the current node.
Dim ESig As Object
Dim bEnabled As Boolean
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if security is enabled
[Link]
bEnabled
MsgBox "Security enabled: " &
bEnabled
CheckSyntax Method Example
The following example returns the syntax
check for the ExpressionEditor object
ExpressionEditor1.
Dim bSuccess As Boolean
Dim strExpression As String
strExpression = "AI1.F_CV +
AI2.F_CV"
bSuccess =
[Link](str
Expression)
CheckUserApplicationAccess
Method Example
The following example creates the ESignature
object, checks to see if the node has electronic
signature enabled, obtains the user ID, checks
to see if the user has access to the Electronic
Signature Bypass application feature, and
checks to see if the user has access to a
security area.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim UserName As String
Dim PassWord As String
Dim result As Boolean
Dim UsrId As String
'valid iFix user name and
password
UserName = "username"
PassWord = "password"
result = False
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Get the user id
[Link] UserName,
PassWord, UsrId
'Check if user has access to
Electronic Signature Bypass
application feature
[Link]
UsrId, 74, result
MsgBox "User: " & UserName & vbCr
& "Has rights to Bypass
Signature? " & result
'Check if user has access to
security area B
[Link] UsrId,
"B", result
MsgBox "User: " & UserName & vbCr
& "Has rights to Security Area B?
" & result
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
CheckUserAreaAccess Method
Example
The following example creates the ESignature
object, checks to see if the node has electronic
signature enabled, obtains the user ID, checks
to see if the user has access to the Electronic
Signature Bypass application feature, and
checks to see if the user has access to a
security area (in this example, B).
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim UserName As String
Dim PassWord As String
Dim result As Boolean
Dim UsrId As String
'valid iFix user name and
password
UserName = "username"
PassWord = "password"
result = False
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Get the user id
[Link] UserName,
PassWord, UsrId
'Check if user has access to
Electronic Signature Bypass
application feature
[Link]
UsrId, 74, result
MsgBox "User: " & UserName & vbCr
& "Has rights to Bypass
Signature? " & result
'Check if user has access to
security area B
[Link] UsrId,
"B", result
MsgBox "User: " & UserName & vbCr
& "Has rights to Security Area B?
" & result
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
Clear Method Example
The following example removes all members
from the Groups collection of FixDataSystem
FDS.
[Link]
ClearUndo Method Example
The following example removes all currently
registered undo transactions from the undo
stack for TestPicture.
[Link]
Close Method Example
The following example closes all open non-
hidden documents, saving changes without
prompting the user.
[Link] 1, 2
The following example opens the
Document TestPicture and then
closes it without saving any
changes.
Dim iDoc As Object
Set iDoc =
[Link]("C:\Pr
ogram Files\Proficy\Proficy
iFIX\pic\[Link]")
[Link] 2, 1
CloseDigitalPoint Subroutine
Example
The following example closes the block DO1.
CloseDigitalPoint "DO1"
ClosePicture Subroutine Example
The following example closes the Picture
TestPicture.
ClosePicture "TestPicture"
Commit Method Example
The following example creates a Rectangle
iRect, customizes it, then commits these
changes.
Dim iRect As Object
Set iRect =
[Link]("Rect")
[Link] = 10.0
[Link] = 30.0
[Link] = 5
[Link] = 1
[Link]
Connect Method Example
The following example ties the value of the
TEMP1 output string to the Caption property
of the Text object Text1.
A connection is a one-way mechanism.
Therefore, changes to the caption property
directly (via OLE automation) will not be
written to the connected source. Also, it may
be necessary to transform the data from one
type or range to another to create the
appropriate user interface (i.e. numeric to
string, numeric to color, numeric to screen
coordinates). To accomplish this, an animation
object should be used (Linear, Lookup,
Format).
Dim objAnim as Object
Dim lngStatus as Long
'Create the animation object
Set objAnim =
[Link]("Linear")
'Initialize the Linear object's
properties
[Link] =
"Fix32.Scada1.AI1.F_CV"
'Set up transformation in and out
range parameters
[Link] = True 'Set it
to fetch limits
[Link] = True 'Set it
for relative movement
[Link] = 0 'Set low
output value
[Link] = 15 'Set high
output value
'Connect the animation object's
output to the rectangle's
position
[Link]
"HorizontalPosition",
[Link] &
".OutputValue", lngStatus
ConnectDataSet Method Example
This method is currently unavailable for use in
iFIX. It is reserved for future use.
ConnectedPropertyCount Method
Example
The following example determines the number
of properties that have connections configured
for the Oval object Oval1.
Dim lCount As Long
[Link]
lCount
Construct Method Example
The following example displays the QuickAdd
user interface that prompts the user for the
information needed to create the tag NewAI1
for the Oval object Oval1 on node NODE1.
Dim lStatus As Long
[Link]
"[Link]", lStatus
Convert_A_Group_To_A_Dynamo_B
y_Name Method Example
There is currently no example available at this
time.
Convert_A_Group_To_A_Dynamo_B
y_Ref Method Example
The following example shows the
Convert_A_Group_To_A_Dynamo_By_Ref
method example using the methods in
PlugandSolve – modDynamoConverter.
Public Function
ConvertADynamo(objGroup As
Fix2DGroup.Fix2DGroup,
objMasterDynamo As
Fix2DDynamo.Fix2DDynamo, ByRef
strReturnMsg) As
UpdateDynamoResult
Dim strDIName As String
Dim strDMName As String
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
Dim iUpdateOptions As Long '
update options
Dim bProceedConvert As
Boolean
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If
g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If
g_ReturnFromPromptForChoiceOnConv
ert =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoiceOnConv
ert =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoiceOnConv
ert =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
' Convert option parameters
iUpdateOptions = &H0
If iDataSourceOption =
DYNAMO_PROMPT_FOR_CHOICE Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_PROMT_F
OR_CHOICE
ElseIf iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_UPDATE_
DYNAMO +
UPDATE_OPTION_ON_MISMATCH_APPLY_D
ATA_SOURCES
ElseIf iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_UPDATE_
DYNAMO
End If
' set options (it includes
update option in case)
If g_WizardConfig.bKeepSize =
True Then
iUpdateOptions =
iUpdateOptions +
UPDATE_OPTION_RESIZE_INSTANCE
End If
If
g_WizardConfig.bKeepCaption =
True Then
iUpdateOptions =
iUpdateOptions +
UPDATE_OPTION_SAVE_CAPTIONS
End If
' if FDS Converter, set Make
Master option
If g_iDynamoToolType =
DYN_FDS_CONVERTER Then
iUpdateOptions =
iUpdateOptions +
CONVERT_OPTION_MAKE_MASTER
End If
' call Update A Dynamo
[Link]
j.Convert_A_Group_To_A_Dynamo_By_
Ref objGroup, iUpdateOptions,
[Link](4143),
iResult
' get a result string
strReturnMsg =
[Link]
t_Last_Result_String
' don't take the last prompt
for choice
' get the last user choice
from the prompt
'If
(g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE) And _
'
(g_ReturnFromPromptForChoiceOn
Convert = PROMPT_DLG_SEL_NONE)
Then
' iPrompt =
[Link]
t_Last_Prompt_Value
' If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL) Or _
' (iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL) Or _
' (iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL) Then
'
g_ReturnFromPromptForChoic
eOnConvert = iPrompt
' End If
'End If
' convert result code
If (iResult And
UPDATER_RESULT_SUCCESS_BIT) > 0
Then
ConvertADynamo =
DYNAMO_UPDATED
End If
If (iResult And
UPDATER_RESULT_DYNAMO_NOT_UPDATED
_BIT) > 0 Then
ConvertADynamo =
DYNAMO_NOTUPDATED
End If
If (iResult And
UPDATER_RESULT_USER_CANCELLED_BIT
) > 0 _
Or (iResult And
UPDATER_RESULT_SUCCESS_BIT) = 0
Then
ConvertADynamo =
DYNAMO_UPDATE_ABORTED
End If
End Function
ConvertPipe Method Example
The following example converts selected
line(s) and polyline(s) to a pipe object in an
active picture.
Set ObjHelper =
BuildObject("GeometryHelper")
Call [Link]
ConvertSecurityAreaNameToNumber
Method Example
The following example converts security area
D to its corresponding area number.
Dim iAreaID As Integer
iAreaID =
[Link]
umber("D")
ConvertSecurityAreaNumberToName
Method Example
The following example converts security area
11 to its corresponding area name.
Dim sAreaName As String
sAreaName =
[Link]
oName(11)
Copy Method Example
The following example selects the Oval object
Oval1 and copies it to the clipboard.
[Link]
[Link]
Coupled_Activate_Workspace_UI
Method Example
The following example activates the
WorkSpace UI.
Application.Coupled_Activate_Work
space_UI
Coupled_DeActivate_Workspace_UI
Method Example
The following example de-activates the
WorkSpace UI, allowing a form to act
modally. This call would be made on the
form's initialization.
Application.Coupled_DeActivate_Wo
rkspace_UI False
The following example de-activates the
WorkSpace UI, allowing a form to act
modeless. This call would be made on the
form's initialization.
Application.Coupled_DeActivate_Wo
rkspace_UI True
CopyAsBitmap Method Example
The following example selects the Oval object
Oval1 and copies it to the clipboard as a
bitmap.
[Link]
[Link]
CreateDynamoByGrouping Method
Example
The following code provides an example of the
CreateDynamoByGrouping method:
Private Sub
btnCreateADynamoByGrouping_Click(
)
' As long as there's selected
objects a Dynamo will be created
using those selected objects.
Me.Create_Dynamo_By_Grouping
End Sub
CreateFromDialog Method Example
The following example creates the
FixControlContainer object and then displays
the Insert Object dialog box to allow the user
to select which ActiveX control to create.
Dim iActiveX As Object
Set iActiveX =
[Link].B
uildObject("oleobject")
[Link]
CreateFromProgID Method Example
The following example creates the
FixControlContainer and then the
AlarmSummary control by specifying its
ProgID.
Dim iActiveX As Object
Set iActiveX =
[Link].B
uildObject("oleobject")
[Link]
"[Link]
trl.2"
CreateWithMouse Method Example
The following example creates an Oval by
allowing the user to specify its size and
position by creating it with the mouse.
Dim iOval As Object
Set iOval =
[Link].B
uildObject("oval")
[Link]
Cut Method Example
The following example selects the Pie object
Pie1 and removes it from its Picture
TestPicture and copies it to the clipboard.
[Link]
[Link]
D
DeActivateWorkspaceUI Method
Example
The following example de-activates the
WorkSpace UI, allowing a form to act
modally. This call would be made on the
form's initialization.
[Link]
False
The following example de-activates the
WorkSpace UI, allowing a form to act
modeless. This call would be made on the
form's initialization.
[Link]
True
DefaultView Method Example
The following example sets the Picture
TestPicture to its default window location.
[Link]
The following example sets the Picture
TestPicture to its default window location,
preventing the repainting of the picture.
[Link] False
DelAlarm Method Example
The following example deletes an alarm
generated for the block titled AI1 on a node
titled NODE1 in the AlarmSummary object
AlarmSummaryOCX1.
Dim iRval As Integer
iRval =
[Link]("NODE1"
, "AI1")
DeleteAllAlarms Method Example
The following example deletes all alarms in
the AlarmSummary object
AlarmSummaryOCX1.
Dim iRval As Integer
iRval =
[Link]
DeleteAllDataSets Method Example
The following example shows an example of
the DeleteAllDataSets method with the
LineChart object.
[Link]
DeleteDataSet Method Example
The following example shows an example of
the DeleteDataSet method with the LineChart
object.
[Link] 0
DeleteImage Method Example
The following example deletes the primary and
secondary images at the index of 1 for the
Bitmap object Bitmap1.
[Link] 1
DeletePen Method Example
The following example uses the Count
property of the Pens Collection for the Chart,
Chart1, as an index to delete the last pen added
to the Chart.
Dim x As Integer
x = [Link]
[Link] x
The following example deletes a pen in a
Chart named Chart1, and then replaces it with
another one using the AddPen method, if it
does not already exist.
Private Sub Chart1_Click()
‘Select a pen on user Click
‘Check if user wants to delete it
Dim Strtn as string
Dim Inti as integer
Strtn = [Link]
Msgprompt = "You have selected
Pen : " &
[Link](Strtn).Source &
vbCrLf & "Do you want to remove
it ?"
user_reponse = MsgBox(Msgprompt,
vbYesNo, "Removing Pen")
If user_reponse = 6 Then
[Link] (Strtn)
End If
End Sub
Private Sub DELPEN_Click()
‘delete all pen from the pen
collection under a specific chart
Dim Inti as integer
If [Link] <> 0 Then
For Inti = [Link] To
1 Step -1
[Link] (Inti)
Next Inti
End If
End Sub
Private Sub PBADDREALPEN_Click()
‘Add pen to the pen collection
for a given Chart
‘after checking the pens are not
already inside the pen collection
If [Link] <> 0 Then
' first time the chart is used
the collection contains a default
pen
[Link] (1)
End If
checkifalreadyexist
("[Link].MyTag1")
checkifalreadyexist
("[Link].MyTag2")
checkifalreadyexist
("[Link].MyTag3")
End Sub
Function
checkifalreadyexist(Tagname As
String)
‘check if the pen if not already
inside the collection
Dim loc_tagname As String
loc_tagname = Tagname & ".F_CV"
Egu_tagname = Tagname
If [Link] = 0 Then
[Link] (loc_tagname)
hiEGU = Readvalue(Egu_tagname &
".A_Ehi")
loEGU = Readvalue(Egu_tagname &
".A_Elo")
Else
Tag_found = False
For i = 1 To [Link]
If UCase(loc_tagname) =
UCase([Link](i).Source)
Then
Tag_found = True
Else
End If
Next i
If Tag_found = False Then
[Link] (loc_tagname)
Tag_found = False
End If
End If
End Function
DeletePoint Method Example
The following example deletes the point at
index 3 for the Polyline object PolyLine1.
[Link] 3
DeleteSelectedObjects Method
Example
The following example selects the Chord and
Polygon objects Chord1 and Polygon1 and
then deletes them from the Picture
TestPicture.
[Link] False
[Link] False
[Link]
DemandFire Method Example
The following example fires the OnTimeOut
configured for the Timer MyTimer object in
the Schedule TestSchedule.
[Link] "MyTimer"
The following example fires the OnTimeOut
event for the Timer MyTimer.
[Link]
The following example fires whatever event is
configured for the Event object MyEvent.
[Link]
DeselectObject Method Example
The following example deselects all objects
currently selected in the Picture TestPicture.
[Link] True
DestroyObject Method Example
The following example deletes the Chord
object Chord1 from its container.
[Link]
DisableAlarm Subroutine Example
The following example disables alarm limit
checking for block AI1.
DisableAlarm "AI1"
DisableNonSelectionEvents Method
Example
Reserved for internal purposes.
Disconnect Method Example
The following example disconnects the
VerticalFillPercentage property of the Oval
object Oval1 from its source.
[Link]
"VerticalFillPercentage"
DisplaysControlPoints Method
Example
The following example prohibits the Oval
object Oval1 from displaying its control points.
[Link] False
DoesPropertyHaveTargets Method
Example
The following example determines if the
VerticalFillPercentage property of the Oval
object Oval1 has a target object connection,
and if so, retains information about the
target(s).
Dim bHasTargets As Boolean
Dim lNumOfTargets As Long
Dim lStatus As Long
Dim lIndex As Long
[Link]
"VerticalFillPercentage",
bHasTargets, lNumOfTargets,
lStatus, lIndex
DoExtendLines Method Example
The following example shows that the selected
line object(s) will be extended to the
intersection when the ExtendType property is
set to shorter than 30 pixels.
Set ObjHelper =
BuildObject("GeometryHelper")
[Link] = 3 'set
extend type max
ObjHelperExtendMaxSpace = 30 '
set max pixels to extend
Call [Link]
DoLinestoPolyline Method Example
The following example shows that the selected
line objects will be converted to polyline
object(s).
Set ObjHelper = BuildObject
("GeometryHelper")
Call [Link]
DoMenuCommand Method Example
The following example instantiates the New
Timer dialog box for the Schedule
TestSchedule as if the user had selected Add
New Timer Entry from the Insert menu.
[Link]
schNewTimer
The following example refreshes the Schedule
after the Event object MyEvent has been
removed from the Schedule TestSchedule.
[Link]
"MyEvent"
[Link]
scHREFreshView
DoTrimLines Method Example
The following example shows that the selected
line object(s) will be trimmed to the extension
point when the TrimType property is set to
shorter than 30 pixels.
Set ObjHelper =
BuildObject("GeometryHelper")
[Link] = 3 ' set trim
type max
[Link] = 30 '
set max trim pixels
Call [Link]
DumpProperties Method Example
The following example writes all of the
properties and their corresponding values for
the Picture TestPicture and its contained
objects to the CSV file [Link].
Dim sRes1 As String
Dim sRes2 As String
[Link]
"C:\Temp\[Link]", True,
sRes1, sRes2
Duplicate Method Example
The following example selects the Oval object
Oval1 and then duplicates it.
[Link]
[Link]
E
EditPicture Method Example
The following example opens the
configuration dialog box for the Picture
TestPicture.
[Link]
Enable Method Example
The following example disables the Color
Button object ColorButton1.
[Link] False
EnableAlarm Subroutine Example
The following example enables alarm limit
checking for block AI1.
EnableAlarm "AI1"
Enumerate_All_Dynamos Method
Example
The following code provides an example of the
Enumerate_All_Dynamos method:
Private Sub
btnEnumAllDynamos_Click()
' Useful to add a reference
to iFix Geometry Helper & iFIX
Collection
Dim GH As
[Link]
er ' Geometry Helper object
Dim DynamoCollection As
Object ' Returned Collection of
Dynamo Objects
Set GH =
[Link]("GeometryHelper")
GH.Enumerate_All_Dynamos
[Link],
DynamoCollection
' Now do something useful
with the returned Dynamos
Dim aDynamo As
Fix2DDynamo.Fix2DDynamo
Dim aStr As String
For Each aDynamo In
DynamoCollection
aStr =
[Link] ' Do
something useful here.
Next aDynamo
[Link]
End Sub
Enumerate_All_Groups Method
Example
The following code provides an example of the
Enumerate_All_Groups method:
Public Function
GetAllGroupList(objPic As
CFixPicture, ByRef colDIList As
Collection) As Boolean
Dim colPIC As
CFixObjectCollection
Dim colList As
CFixObjectCollection
Dim objDI As Object
If TypeName(objPic) =
"Nothing" Or [Link] <>
"Pictures" Then
GetAllGroupList = False
GoTo CLEAN_UP
End If
'If [Link] <>
"GeometryHelper" Then
' GetMasterDynamoList =
False
' GoTo CLEAN_UP
'End If
' clear dynamo instance list
Do While [Link] > 0
[Link] (1)
Loop
' get all Master Dynamos on a
specified DynamoSets
Set colPIC =
[Link]
Call
[Link]
umerate_All_Groups(colPIC,
colList)
If [Link] <= 0 Then
GetAllGroupList = True
GoTo CLEAN_UP
End If
For Each objDI In colList
[Link] objDI
Next objDI
GetAllGroupList = True
CLEAN_UP:
On Error Resume Next
Set colList = Nothing
Set colPIC = Nothing
Set objDI = Nothing
End Function
Enumerate_Top_Level_Dynamos
Method Example
The following code provides an example of the
Enumerate_Top_Level_Dynamos method:
Private Sub
btnEnumTopLevelDynamos_Click()
' Useful to add a reference
to iFix Geometry Helper & iFIX
Collection
Dim GH As
[Link]
er ' Geometry Helper object
Dim DynamoCollection As
Object ' Returned Collection of
Dynamo Objects
Set GH =
[Link]("GeometryHelper")
GH.Enumerate_Top_Level_Dynamo
s [Link],
DynamoCollection
' Now do something useful
with the returned Dynamos
Dim aDynamo As
Fix2DDynamo.Fix2DDynamo
Dim aStr As String
For Each aDynamo In
DynamoCollection
aStr =
[Link] ' Do
something useful here.
Next aDynamo
[Link]
End Sub
Enumerate_Top_Level_Groups
Method Example
The following code provides an example of the
Enumerate_Top_Level_Groups method:
Public Function
GetOldDynamoList(objFDS As
CFixDynamoSet, ByRef colDMList As
Collection) As Boolean
Dim colFDS As
CFixObjectCollection
Dim colList As
CFixObjectCollection
Dim objDM As Object
If TypeName(objFDS) =
"Nothing" Or [Link] <>
"Dynamo Sets" Then
GetOldDynamoList = False
GoTo CLEAN_UP
End If
'If [Link] <>
"GeometryHelper" Then
' GetMasterDynamoList =
False
' GoTo CLEAN_UP
'End If
' clear dynamo instance list
Do While [Link] > 0
[Link] (1)
Loop
' get all Master Dynamos on a
specified DynamoSets
Set colFDS =
[Link]
Call
[Link]
umerate_Top_Level_Groups(colFDS,
colList)
If [Link] <= 0 Then
GetOldDynamoList = True
GoTo CLEAN_UP
End If
For Each objDM In colList
[Link] objDM
Next objDM
GetOldDynamoList = True
CLEAN_UP:
On Error Resume Next
Set colList = Nothing
Set colFDS = Nothing
Set objDM = Nothing
End Function
ESignature Object Example
To use the ESignature object from VBA,
declare an object variable and create the object
by calling CreateObject( ). You can then
access the ESignature object’s methods
through the object variable.
The sample code below illustrates how to use
the ESignature object in VBA applications.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim Value as Variant
'Create the ESignature object
Set ESig = CreateObject
(“[Link]"
)
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if data source requires
electronic signature
[Link] ("Fix32.
THISNODE.DO1.F_CV")
[Link] 0,
bSigRequired
If bSigRequired = True Then
'Capture the signature and write
the new value
Value = 1
[Link] 0,
Value
Else
'Signature not required for this
data source, just write the value
End If
Else
'Signature not enabled on this
node, just write the value
End If
ExchangePenPositions Method
Example
The following example sets the location of the
Pen in position 1 to position 3 in the Pens
collection.
[Link] 3, 1
ExportData Method Example
The following example exports the file to the
location C:\TEMP\[Link], in table
format.
Private Sub
CommandButton6_Click()
[Link]
"C:\TEMP\[Link]",
DataExportStyle_VerticalTable
End Sub
ExportImage Method Example
The following example exports the image to
the clipboard, in the PNG file format, in the
size of 800 X 600 pixels.
Private Sub
CommandButton8_Click()
[Link] "",
ImageFormat_PNG,
SizeUnits_Pixels, 800, 600
End Sub
ExportLanguageFile Method Example
The following example exports a Spanish
language file.
[Link] = ES_Spanish
[Link]
- OR -
[Link]
(ES_Spanish)
F
FetchLimits Subroutine Example
The following example gets the high and low
EGUs for the data item
FIX32.NODE1.AI1.F_CV and enters them in
two text fields.
Dim sngHi As Single
Dim sngLo As Single
Dim intRet As Integer
Call FetchLimits
("FIX32.NODE1.AI1.F_CV", sngHi,
sngLo, intRet)
If intRet = 0 Then
[Link] = sngHi
[Link] = sngLo
End If
FindAndReplaceDialog Method
Example
The following example opens the Find And
Replace dialog for the Picture TestPicture.
[Link]
FindDataSource Subroutine Example
The following example finds the datasource
for the VerticalFillPercentage property of the
object Tank1, which is contained in the
Picture TestPicture.
Dim iTank As Object
Dim sDataSource As String
Set iTank = untitled1.Tank1
sDataSource =
FindDataSource(iTank,
"VerticalFillPercentage")
FindInString Method Example
The following example finds each occurrence
of the string AI1 with the string
FIX32.NODE1.AI1.F_CV. The operation is
specified to include scripts in the search.
Dim lFirst As Long
Dim lCount As Long
Dim sMatchString As String
Dim bFound As Boolean
[Link]
"FIX32.NODE1.AI1.F_CV", 1, "AI1",
8, sMatchString, lFirst, lCount,
bFound
FindLocalObject Subroutine Example
The following example finds the object
PipeColorA within the Group Pipe.
Dim PipeSectObj As Object
Set PipeSectObj =
FindLocalObject(Pipe,
"PipeColorA")
FindObject Method Example
The following example returns the Picture
object TestPicture.
Dim iPic as object
Set iPic =
[Link]("TestPicture")
The following example returns a
data item reference for the block
AI1 on node NODE1.
Dim iDataItem as object
Set iDataItem =
[Link]("[Link]
1.F_CV")
The following example returns an
animation object for the
Rectangle object Rect4 in Picture
TestPicture.
Dim iLinear as object
Set iLinear =
[Link]("[Link]
[Link]")
FindReplaceInObject Method
Example
The following example replaces each instance
of the string NODE1 with the string NODE2
within the Group object Group1. The
operation is specified to be case sensitive.
Dim bFound as Boolean
[Link]
Group1, 1, "NODE1", "NODE2",
bFound
FindReplaceInString Method Example
The following example finds the first
occurrence of the string AI1 within the string
FIX32.NODE1.AI1.F_CV and replaces it with
AI2, returning the new string in sReplacement.
The operation is specified to include scripts in
the search.
Dim lFirst As Long
Dim lCount As Long
Dim bsuccess As Boolean
Dim sTarget As String
Dim sReplacement As String
sTarget = "FIX32.NODE1.AI1.F_CV"
[Link]
sTarget, 1, "AI1", "AI2", 8,
lFirst, lCount, sReplacement,
bsuccess
FitDocumentToWindow Method
Example
The following example changes the size of the
TestPicture Document to fit within the
window.
[Link]
The following example changes the size of the
TestPicture Document to fit within the
window, preventing the repainting of the
Picture.
TestPicture. FitDocumentToWindow
False
FitWindowToDocument Method
Example
The following example changes the size of the
window to fit the size of the TestPicture
Document.
[Link]
The following example changes the size of the
window to fit the size of the TestPicture
Document, preventing the repainting of the
Picture.
TestPicture. FitWindowToDocument
False
FixCheckApplicationAccess Method
Example
The following example checks to see if the
user has access to the specified application.
Dim lAccess as long
lAccess =
[Link](
DatabaseManager)
FixCheckApplicationAccessQuiet
Method Example
The following example checks to see if the
user has access to the specified application.
Dim lAccess as long
lAccess =
[Link]
uiet(DatabaseManager)
FixCheckAreaAccess Method
Example
The following example checks to see if the
user has access to the security area 11.
Dim lAccess as long
lAccess =
[Link](11)
FixCheckAreaAccessQuiet Method
Example
The following example checks to see if the
user has access to the security area 11.
Dim lAccess as long
lAccess =
[Link](11
)
FixCheckSecurityEnabled Method
Example
The following example checks to see if
security is enabled.
Dim lEnabled as long
lEnabled =
[Link]()
FixGetManualAlmDeleteEnabled
Method Example
This example shows how to enable manual
alarm deletions.
Dim bManlAlmDel As Boolean
[Link]
ed bManlAlmDel
If bManlAlmDel = True Then
MsgBox "Manual alarm deletion is
enabled"
End If
FixGetUserInfo Method Example
The following example retrieves login
information about the current user, including
the user ID, user name and group name.
Dim sUserID as string
Dim sUserName as string
Dim sGroupName as string
[Link] sUserID,
sUserName, sGroupName
FixLogin Method Example
The following example logs in the user
TestUser with a password of MyPassword.
[Link] "TestUser",
"MyPassword"
FixLogout Method Example
The following example logs out the first user.
[Link]
FontProperties Method Example
The following example opens the font dialog
for the Text object Text1.
[Link]
FullView Method Example
The following example resizes the TestPicture
Document to take up the entire screen.
[Link]
G
GeneratePicture Subroutine Example
Dim aPicInfo As PictureInfo
[Link] = TopPct
[Link] = LeftPct
[Link] = 100
[Link] = 100
[Link] = RGB(255,0,0)
[Link] = "Tank1"
[Link] = True
[Link] = True
[Link] = True
[Link] = True
[Link] = False
[Link] = True
Dim retVal
retVal =
GeneratePicture(aPicInfo)
Get_Last_Prompt_Value Method
Example
The following code provides an example of the
Get_Last_Prompt_Value method that appears
in the modDynamoUpdater module of the
Project_PlugandSolve VBA project.
Public Function
UpdateADynamo(objDynamoInstance
As Fix2DDynamo.Fix2DDynamo,
objMasterDynamo As
Fix2DDynamo.Fix2DDynamo, ByRef
strReturnMsg) As
UpdateDynamoResult
Dim strDIName As String
Dim strDMName As String
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If
g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
'////// actual update call
' call Update A Dynamo
[Link]
j.Update_A_Dynamo_By_Ref
objMasterDynamo,
objDynamoInstance,
iDataSourceOption,
[Link](4069),
iResult
' get a result string
strReturnMsg =
[Link]
t_Last_Result_String
' get the last user choice
from the prompt
If
(g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE) And _
(g_ReturnFromPromptForCho
ice = PROMPT_DLG_SEL_NONE) Then
iPrompt =
[Link]
t_Last_Prompt_Value
If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL) Then
g_ReturnFromPromptFor
Choice = iPrompt
End If
End If
'////// end of actual update call
'////// dummy for test
' g_testcount = g_testcount +
1
' strDIName =
[Link]
' strDMName =
[Link]
' If g_testcount = 3 Then
' strReturnMsg = ">>>" &
strDIName & " was not updated
with " & strDMName
' iResult =
DYNAMO_NOTUPDATED
' ElseIf g_testcount = 150
Then
' strReturnMsg = ">>> User
canceled"
' iResult =
DYNAMO_UPDATE_ABORTED
' Else
' strReturnMsg = strDIName
& " was updated successfully with
" & strDMName
' iResult = DYNAMO_UPDATED
' End If
'////// end of dummy for test
If iResult <= DYNAMO_UPDATED
Then
UpdateADynamo =
DYNAMO_UPDATED
ElseIf iResult <=
DYNAMO_NOTUPDATED Then
UpdateADynamo =
DYNAMO_NOTUPDATED
Else
UpdateADynamo =
DYNAMO_UPDATE_ABORTED
End If
End Function
To view this code in context:
1. In Classic view, from the WorkSpace
menu, select Visual Basic Editor.
-Or-
In Ribbon view, on the Home tab, in
the WorkSpace group, click Visual
Basic Editor.
2. In the tree view, double-click the
Project_PlugandSolve folder, and then
the Modules folder, and finally the
modDynamoUpdater.
3. Search for UpdateADynamo to locate
this code.
Get_Last_Result_String Method
Example
The following code provides an example of the
Get_Last_Result_String method that appears
in the modDynamoUpdater module of the
Project_PlugandSolve VBA project.
Public Function
UpdateADynamo(objDynamoInstance
As Fix2DDynamo.Fix2DDynamo,
objMasterDynamo As
Fix2DDynamo.Fix2DDynamo, ByRef
strReturnMsg) As
UpdateDynamoResult
Dim strDIName As String
Dim strDMName As String
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If
g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
'////// actual update call
' call Update A Dynamo
[Link]
j.Update_A_Dynamo_By_Ref
objMasterDynamo,
objDynamoInstance,
iDataSourceOption,
[Link](4069),
iResult
' get a result string
strReturnMsg =
[Link]
t_Last_Result_String
' get the last user choice
from the prompt
If
(g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE) And _
(g_ReturnFromPromptForCho
ice = PROMPT_DLG_SEL_NONE) Then
iPrompt =
[Link]
t_Last_Prompt_Value
If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL) Then
g_ReturnFromPromptFor
Choice = iPrompt
End If
End If
'////// end of actual update call
'////// dummy for test
' g_testcount = g_testcount +
1
' strDIName =
[Link]
' strDMName =
[Link]
' If g_testcount = 3 Then
' strReturnMsg = ">>>" &
strDIName & " was not updated
with " & strDMName
' iResult =
DYNAMO_NOTUPDATED
' ElseIf g_testcount = 150
Then
' strReturnMsg = ">>> User
canceled"
' iResult =
DYNAMO_UPDATE_ABORTED
' Else
' strReturnMsg = strDIName
& " was updated successfully with
" & strDMName
' iResult = DYNAMO_UPDATED
' End If
'////// end of dummy for test
If iResult <= DYNAMO_UPDATED
Then
UpdateADynamo =
DYNAMO_UPDATED
ElseIf iResult <=
DYNAMO_NOTUPDATED Then
UpdateADynamo =
DYNAMO_NOTUPDATED
Else
UpdateADynamo =
DYNAMO_UPDATE_ABORTED
End If
End Function
To view this code in context:
1. In Classic view, from the WorkSpace
menu, select Visual Basic Editor.
-Or-
In Ribbon view, on the Home tab, in
the WorkSpace group, click Visual
Basic Editor.
2. In the tree view, double-click the
Project_PlugandSolve folder, and then
the Modules folder, and finally the
modDynamoUpdater.
3. Search for UpdateADynamo to locate
this code.
GetAllConnections Subroutine
Example
The following example shows how to use a
click event on rectangle object to retrieve all
data items within a picture and then display
them in a message box.
Private Sub Rect2_Click()
Dim obj
Dim str As String
GetAllConnections Me
For Each obj In
AllConnectionsCollection
str = str & CStr(obj) & vbCr
Next
MsgBox str, , [Link]
End Sub
GetBoundRect Method Example
The following example retrieves the points of
the bounding rectangle of the Oval object
Oval1.
Dim dTop As Double
Dim dLeft As Double
Dim dBottom As Double
Dim dRight As Double
[Link] dTop, dLeft,
dBottom, dRight
GetColHeadings Method Example
The following example retrieves the column
headings of the alarm summary object. In this
example, the column headings will be returned
in the variable bstrColHeadings.
Dim lErr as Long
Dim bstrColHeadings As String
lErr =
[Link](b
strColHeadings)
GetColumnInfo Method Example
The following example retrieves the item name
and number of characters displayed in column
3 for the Chart Chart1.
Dim sItemName As String
Dim iNumChar As Integer
[Link] 3,
sItemName, iNumChar
GetConnectionInformation Method
Example
The following example retrieves the
connection information for the first connection
for the Oval object Oval1.
Dim sPropName As String
Dim sSource As String
Dim sFullQualSource As String
Dim vSourceObjs As Variant
Dim vTolerance As Variant
Dim vDeadBand As Variant
Dim vUpdateRate As Variant
[Link] 1,
sPropName, sSource,
sFullQualSource, vSourceObjs,
vTolerance, vDeadBand,
vUpdateRate
GetConnectionParameters Method
Example
The following example returns the
UpdateRate, Deadband and Tolerance for the
ForegroundColor property connection for the
Oval object Oval1.
Dim vTolerance As Variant
Dim vDeadBand As Variant
Dim vUpdateRate As Variant
Dim vFlags As Variant
[Link]
"ForegroundColor", vUpdateRate,
vDeadBand, vTolerance, vFlags
GetContinuousUser Method Example
The following example ensures that the User
Name entered is valid, creates the ESignature
object, checks that the node is enabled for
electronic signature, and sets and gets the
name of the continuous user.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim UserName As String
Dim SetName As String
'valid user name
SetName = "TestUser"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Set the name of the continuous
user to "TestUser"
[Link] SetName
'Get the name of the continuous
user
[Link] UserName
MsgBox “Continuous User: ” &
UserName
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
GetCurrentDataSet Method Example
The following example retrieves the object
reference to the current dataset for the
Line/Multiline chart.
Private Sub
CommandButton2_Click()
Dim objDataSet As Object
Set objDataSet =
[Link]()
' Set the color of the dataset to
its complement.
[Link] =
[Link] Xor (-1)
End Sub
GetCurrentValueWithQuality Method
Example
The following example displays the current
value of x, y, and the data quality of the
Enhanced Chart in a message box, which are
returned using the
GetCurrentValueWithQuality method.
Private Sub
CommandButton11_Click()
Dim objDataSet As Object '
[Link]
aSet
Dim varXValue As Variant,
dblYValue As Double, lngQuality
As Long
Set objDataSet =
[Link]()
[Link]
lity varXValue, dblYValue,
lngQuality
MsgBox "AssignedID is " &
CStr([Link]) &
vbCrLf & _
"ResolvedSourceName is " &
CStr([Link]
e) & vbCrLf & _
"Current X Value is " &
CStr(varXValue) & vbCrLf & _
"Current X Value is " &
CStr(dblYValue) & vbCrLf & _
"Current Quality is " &
CStr(lngQuality)
End Sub
GetCurrentValue Method Example
The following example retrieves the value,
timestamp, and quality information for Pen
Pen1.
Dim dCurVal As Double
Dim dt As Date
Dim lQual As Long
[Link] dCurVal, dt,
lQual
GetDataSetByPosition Method
Example
The following example shows an example of
the GetDataSetByPosition method with the
LineChart object.
Dim objDS As Object
Set objDS =
[Link](2
)
Return Value
Object. The dispatch pointer of
the Dataset object retrieved by
position.
GetDecimalSeparator Subroutine
Example
The following example retrieves the decimal
separator set for the local machine.
Dim sDecimal As String
sDecimal = GetDecimalSeparator
GetDeviceRect Method Example
The following example retrieves the points of
the bounding rectangle of the Oval object
Oval1 in device coordinates.
Dim dTop As Long
Dim dLeft As Long
Dim dBottom As Long
Dim dRight As Long
[Link] dTop, dLeft,
dBottom, dRight
GetDuration Method Example
The following example retrieves the duration
for the Chart Chart1.
Dim lDays As Long
Dim lHours As Long
Dim lMinutes As Long
Dim lSeconds As Long
[Link] lDays, lHours,
lMinutes, lSeconds
GetErrorString Method Example
The following is an example of how a user
might use GetErrorString to handle errors that
occur. In this example, setting
[Link] = 4 causes an error,
forcing the error handler to take effect.
Dim sErrString As String
On Error GoTo errhand
[Link] = 4
errhand:
sErrString =
[Link]([Link])
GetEventHandlerIndex Method
Example
The following example gets the index number
for the Click of the object CurrentObject and,
if a procedure exists, removes it.
[Link]
HandlerIndex "Click", lIndex,
lFound
If lFound = 1 Then
[Link]
lIndex
End If
GetFormDynamoColor Subroutine
Example
The following example retrieves an instance of
the form named DynamoColorBy.
Dim frmDynamoColor as Object
GetFormDynamoColor frmDynamoColor
GetFormNumeric Subroutine
Example
Reserved for internal purposes.
GetFormPushbutton Subroutine
Example
Reserved for internal purposes.
GetFormRamp Subroutine Example
Reserved for internal purposes.
GetFormSlider Subroutine Example
Reserved for internal purposes.
GetFullname Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, displays the Electronic
Signature dialog box, validates the signature
and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim bValidSig As Boolean
Dim PerformUserName As String
Dim PerformUserID As String
Dim PerformComment As String
Dim PerformFullName As String
Dim VerifyUserName As String
Dim VerifyUserID As String
Dim VerifyComment As String
Dim VerifyFullName As String
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
bVerify = True ' verification is
not required
bContinuousUse = True ' allow
continuous user, if any, to be
displayed in the dialog box
bValidSig = False ' will be set
to TRUE by GetSignature if
signature is captured
successfully
'Display the Electronic Signature
dialog box
[Link] "Action
Description", bVerify,
bContinuousUse, bValidSig,
Ucase(PerformUserName),
Ucase(PerformUserID),
PerformComment,
Ucase(VerifyUserName),
Ucase(VerifyUserID),
VerifyComment
If bValidSig = True Then
'Send a message to the audit
trail
[Link]
"Action Description", "", "",
Ucase (PerformUserID),
PerformComment,
Ucase(VerifyUserID),
VerifyComment
'Get the full names of the
signers
[Link]
Ucase(PerformUserID),
Ucase(PerformFullName)
[Link]
Ucase(VerifyUserID),
Ucase(VerifyFullName)
'Show Results
MsgBox "Action performed by " +
PerformUserName + " (" +
PerformFullName + ") " +
PerformComment + " and verified
by " + VerifyUserName + " (" +
VerifyFullName + ") " +
VerifyComment
Else
MsgBox "Signature was not
captured."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
GetIndirectionInfo Method Example
Reserved for internal purposes.
GetInterval Method Example
The following example retrieves the interval
for the Pen Pen1.
Dim lDays As Long
Dim lHours As Long
Dim lMinutes As Long
Dim lSeconds As Long
[Link] lDays, lHours,
lMinutes, lSeconds
GetNumberOfDataSets Method
Example
The following example shows an example of
the GetNumberOfDataSets method with the
LineChart object.
Dim nNumOfDS As Long
nNumOfDS =
[Link]
GetLevel Method Example
The following example retrieves the level
properties for the Lookup object iLookup at
the level index 1 for the Oval object Oval1.
Dim iLookup As Object
Dim vIn1 as Variant
Dim vOut1 as Variant
Dim vIn2 as Variant
dim vOut2 as Variant
Set iLookup =
[Link]("[Link]
[Link]")
[Link] 1, vIn1, vOut1,
vIn2, vOut2
GetLocaleInfoA Subroutine Example
The following example uses the
GetLocaleInfoA call to get the decimal
separator specified for the local machine. We
will also use the API call.
GetUserDefaultLCID to obtain the default
locale of the local user. This gives us the first
parameter for GetLocaleInfoA.
Public Function
GetDecimalSeparator()
Dim intCountChar As Integer
Dim lngHolder As Long
Dim strDecChar As String
On Error GoTo ErrorHandler
'Set the buffer for the return
value
strDecChar = Space$(255)
'Get the decimal separator and
the count of characters for the
thousand 'separator
lngHolder =
GetLocaleInfoA(GetUserDefaultLCID
(), LOCALE_SDECIMAL, strDecChar,
Len(strDecChar) + 1)
'Now set the return value to just
the decimal separator.
GetDecimalSeparator =
Left$(strDecChar, lngHolder - 1)
Exit Function
ErrorHandler:
HandleError
End Function
GetObjectInfo Method Example
The following example retrieves a two
dimensional array consisting of the values for
StartTime and Interval for the Timer objects
MyTimer and MyTimer1.
Dim iSched As Object
Dim Objects(1) As String
Dim Properties(1) As String
Dim Objinfo As Variant
Objects(0) = "MyTimer"
Objects(1) = "MyTimer1"
Properties(0) = "StartTime"
Properties(1) = "Interval"
Set iSched =
[Link]("TestSchedule")
objinfo =
[Link](objects,
properties)
GetPenDataArray Method Example
The following example generate a report
containing all data contained inside a standard
chart, Chart1, into a file.
Dim lNumPts As Long
Dim vVal As Variant
Dim vPsa As Variant
Dim vQual As Variant
Dim vMill As Variant
Dim toto As Object
Dim Mypath As String
Dim myfile As String
Dim RTN As String
RTN = ""
If [Link] <> 0 Then
Mypath = [Link]
myfile = Mypath &
"\app\[Link]"
RTN = Dir(myfile)
If RTN <> "" Then
'File do exist
'Delete Output file
Kill myfile
End If
Open myfile For Output As #1
For i = 1 To [Link]
[Link](i).GetPenDataArr
ayEx lNumPts, vVal, vPsa, vQual,
vMill
For j = 0 To (lNumPts - 1)
Value = vVal(j)
Time = vPsa(j)
Quality = vQual(j)
Mill = vMill(j)
Write #1,
[Link](i).Source; " ";
Time; " "; Value; ""
Next j
Next i
Close #1
End If
GetPenDataArrayEx Method Example
The following example fetches the data array
for the Pen Pen1.
Dim lNumPts As Long
Dim vVal As Variant
Dim vPsa As Variant
Dim vQual As Variant
Dim vMill As Variant
[Link] lNumPts,
vVal, vPsa, vQual, vMill
GetPointAt Method Example
The following example retrieves the point
object at the point index 2 for the Polygon
object Polygon1.
Dim iPoint As Object
Dim dX as double
Dim dY as double
Set iPoint =
[Link](2)
dX = iPoint.x
dY = iPoint.y
GetPriorityColor Method Example
The following example retrieves the color for
each alarm priority in the AlarmSummary
object AlarmSummaryOCX1.
Dim lLow As OLE_COLOR
Dim lMedium As OLE_COLOR
Dim lHigh As OLE_COLOR
lLow =
[Link]
(7)
lMedium =
[Link]
(6)
lHigh =
[Link]
(5)
GetProcedureIndex Example
The following example finds the index of the
procedure Rect2_DisplayMessage in the
ActiveDocument's project.
Dim o As Object
Dim oProc As Object
Dim lIndex As Long
Dim lFound As Long
Set o =
[Link].F
indObject("Rect2")
[Link]
"DisplayMessage", lIndex, lFound
If (lFound) Then
Set oProc =
[Link](lIndex)
End If
GetProperty Method Example
The following example retrieves the value of
the Caption property of the Text object Text1.
Dim vValue As Variant
[Link] "Caption",
vValue
The following example retrieves
the value of the FillStyle
property of the Rectangle object
Rect1.
Dim vValue As Variant
[Link] "FillStyle",
vValue
GetPropertyAttributes Method
Example
The following example fetches the attribute
information for the HighEGU attribute of the
AI1 block on node NODE1.
Dim vtResults
Dim vtAttributes
Dim lStatus As Long
Dim strLoEGU as String
Dim LoEGUval
[Link]
"FIX32.NODE1.AI1.F_CV", 3,
vtResults, vtAttributes, lStatus
strLoEGU = vtAttributes(0)
LoEGUval = vtResults(0)
In the above example, the variable strLoEGU
will now hold the string
"FIX32.NODE1.AI1.A_ELO" and the variable
LoEGUval will hold tag AI1's low EGU
value.
GetPropertyTargets Method Example
The following example determines which
objects are connected to a specific tag
reference.
Dim sPropName As String
Dim vtTargets As Variant
[Link] 1,
sPropName, vtTargets
GetSelectedAlmExt Method Example
The following example retrieves the alarm
extensions configured for the currently
selected alarm in the AlarmSummary object
AlarmSummaryOCX1.
Dim sExt1 As String
Dim sExt2 As String
[Link]
t sExt1, sExt2
GetSelectedNodeTag Method
Example
The following example retrieves the node and
tag name corresponding to the currently
selected alarm in the AlarmSummary object
AlarmSummaryOCX1.
Dim sNode As String
Dim sTag As String
[Link]
ag sNode, sTag
GetSelectedRow Method Example
The following example retrieves the
information for the selected alarm in the
AlarmSummary object AlarmSummaryOCX1.
Dim bAck As Boolean
Dim sHandle As String
Dim sArea As String
Dim sDateIn As String
Dim sDateLast As String
Dim sTimeIn As String
Dim sTimeLast As String
Dim sNode As String
Dim sTag As String
Dim sPriority As String
Dim sStatus As String
Dim sDesc As String
Dim sValue As String
Dim sExt1 As String
Dim sExt2 As String
Dim sUser1 As String
Dim sUser2 As String
[Link]
bAck, sHandle, sArea, sDateIn,
sDateLast, sTimeIn, sTimeLast,
sNode, sTag, sPriority, sStatus,
sDesc, sValue, sExt1, sExt2,
sUser1, sUser2
GetSelectedUserDefFields Method
Example
The following example retrieves value of the
"A_" fields configured for the currently
selected alarm in the AlarmSummary object
AlarmSummaryOCX1.
Dim sUserDef1 As String
Dim sUserDef2 As String
[Link]
efFields sUserDef1, sUserDef2
GetSignature Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, displays the Electronic
Signature dialog box, validates the signature
and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim bValidSig As Boolean
Dim PerformUserName As String
Dim PerformUserID As String
Dim PerformComment As String
Dim PerformFullName As String
Dim VerifyUserName As String
Dim VerifyUserID As String
Dim VerifyComment As String
Dim VerifyFullName As String
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
bVerify = True ' verification is
not required
bContinuousUse = True ' allow
continuous user, if any, to be
displayed in the dialog box
bValidSig = False ' will be set
to TRUE by GetSignature if
signature is captured
successfully
'Display the Electronic Signature
dialog box
[Link] "Action
Description", bVerify,
bContinuousUse, bValidSig,
Ucase(PerformUserName),
Ucase(PerformUserID),
PerformComment,
Ucase(VerifyUserName),
Ucase(VerifyUserID),
VerifyComment
If bValidSig = True Then
'Send a message to the audit
trail
[Link]
"Action Description", "", "",
Ucase (PerformUserID),
PerformComment,
Ucase(VerifyUserID),
VerifyComment 'Get the full names
of the signers
[Link]
Ucase(PerformUserID),
Ucase(PerformFullName)
[Link]
Ucase(VerifyUserID),
Ucase(VerifyFullName)
'Show Results
MsgBox "Action performed by " +
PerformUserName + " (" +
PerformFullName + ") " +
PerformComment + " and verified
by " + VerifyUserName + " (" +
VerifyFullName + ") " +
VerifyComment
Else
MsgBox "Signature was not
captured."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
GetSignatureAndWriteValue Method
Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, determines if the tag
[Link].D01.F_CV requires electronic
signature, captures the signature, writes the
new value, and sends a message to the audit
trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim NewValue As Variant
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if tag requires electronic
signature
[Link]
"[Link].DO1.F_CV"
[Link] 0,
bSigRequired
If bSigRequired = True Then
'Capture the signature, write the
new value and send a message to
the audit trail
NewValue = 1
[Link] 0,
NewValue
Else
MsgBox "Signature is not required
for this tag."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
GetStatusColor Method Example
The following example retrieves the color for
alarms with a HIHI status in the
AlarmSummary object AlarmSummaryOCX1.
Dim lHiHi As OLE_COLOR
lHiHi =
[Link](2
)
GetStatusFont Method Example
The following example retrieves the font
properties for alarms with a LO status in the
AlarmSummary object AlarmSummaryOCX1.
Dim sFontName As String
Dim bStrike As Boolean
Dim bUnderline As Boolean
Dim bBold As Boolean
Dim bItalic As Boolean
Dim iSize As Integer
sFontName =
[Link](3,
bStrike, bUnderline, bBold,
bItalic, iSize)
GetTimeBeforeNow Method Example
The following example retrieves the initial
relative start time for the Chart object Chart1.
Dim lHours As Long
Dim lMinutes As Long
Dim lSeconds As Long
[Link] lHours,
lMinutes, lSeconds
GetTimeCursorInfo Method Example
The following example fetches the time, value
and quality of the trend at the time where the
Pen at index 1 for the Chart Chart1 crosses
the time cursor.
Dim Dt As Date
Dim dVal As Double
Dim lQual As Long
[Link] 1, Dt,
dVal, lQual
GetUserDefaultLCID Subroutine
Example
The following example uses the
GetLocaleInfoA call to get the decimal
separator specified for the local machine. We
will also use the API call
GetUserDefaultLCID to obtain the default
locale of the local user. This gives us the first
parameter for GetLocaleInfoA.
Public Function
GetDecimalSeparator()
Dim intCountChar As Integer
Dim lngHolder As Long
Dim strDecChar As String
On Error GoTo ErrorHandler
'Set the buffer for the return
value
strDecChar = Space$(255)
'Get the decimal separator and
the count of characters for the
thousand 'separator
lngHolder =
GetLocaleInfoA(GetUserDefaultLCID
(), LOCALE_SDECIMAL, strDecChar,
Len(strDecChar) + 1)
'Now set the return value to just
the decimal separator.
GetDecimalSeparator =
Left$(strDecChar, lngHolder - 1)
Exit Function
ErrorHandler:
HandleError
End Function
GetUserID Method Example
The following example creates the ESignature
object, checks to see if the node has electronic
signature enabled, obtains the user ID, checks
to see if the user has access to the Electronic
Signature Bypass application feature, and
checks to see if the user has access to a
security area.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim UserName As String
Dim PassWord As String
Dim result As Boolean
Dim UsrId As String
'valid iFix user name and
password
UserName = "username"
PassWord = "password"
result = False
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Get the user id
[Link] UserName,
PassWord, UsrId
MsgBox “UserID: ” & UsrId
'Check if user has access to
Electronic Signature Bypass
application feature
[Link]
UsrId, 74, result
MsgBox "User: " & UserName & vbCr
& "Has rights to Bypass
Signature? " & result
'Check if user has access to
security area B
[Link] UsrId,
"B", result
MsgBox "User: " & UserName & vbCr
& "Has rights to Security Area B?
" & result
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
GetWindowLocation Method Example
The following example retrieves the window
size and location of the Picture TestPicture in
terms of percentage of the screen.
Dim dTopPct As Double
Dim dLeftPct As Double
Dim dHeightPct As Double
Dim dWidthPct As Double
[Link]
dTopPct, dLeftPct, dHeightPct,
dWidthPct
GlobalScrollBackFast Method
Example
The following example sets the
[Link] and
[Link] properties and scrolls
backward by the amount specified in the
GlobalFastScrollRate property.
Private Sub
FastLeftButton_Click()
[Link]
End Sub
GlobalScrollBackSlow Method
Example
The following example sets the
[Link] and
[Link] properties and scrolls
backward by the amount specified in the
GlobalSlowScrollRate property.
Private Sub LeftButton_Click()
[Link]
End Sub
GlobalScrollForwardFast Method
Example
The following example sets the
[Link] and
[Link] properties and scrolls
forward by the amount specified in the
GlobalFastScrollRate property.
Private Sub
FastRightButton_Click()
[Link]
End Sub
GlobalScrollForwardSlow Method
Example
The following example sets the
[Link] and
[Link] properties and scrolls
forward by the amount specified in the
GlobalSlowScrollRate property.
RightButton_Click()
[Link]
End Sub
GlobalTimerApply Method Example
The following example changes the System's
GlobalStartTime property and applies it to the
WorkSpace.
Private Sub DTPicker7_Change()
[Link] =
[Link]
[Link]
End Sub
Group Method Example
The following example forms a group
consisting of the Oval and Polygon objects
Oval1 and Polygon1.
[Link] False
[Link] False
[Link]
H
HandleError Subroutine Example
The following example demonstrates how the
HandleError subroutine would be used in
trapping errors.
Public Function
GetDecimalSeparator()
Dim intCountChar As Integer
Dim lngHolder As Long
Dim strDecChar As String
On Error GoTo ErrorHandler
'Set the buffer for the return
value
strDecChar = Space$(255)
'Get the decimal separator and
the count of characters for the
thousand 'separator
lngHolder =
GetLocaleInfoA(GetUserDefaultLCID
(), LOCALE_SDECIMAL, strDecChar,
Len(strDecChar) + 1)
'Now set the return value to just
the decimal separator.
GetDecimalSeparator =
Left$(strDecChar, lngHolder - 1)
Exit Function
ErrorHandler:
HandleError
End Function
HiLoDisplay Method Example
The following example sets the HiDisplay and
LoDisplay properties of the TimeAxis object
for the Pen Pen1 to 11/15/98 and 10/17/98
respectively.
Dim iTimeAxis as object
set iTimeAxis = [Link]
[Link] #11/15/98
[Link]M#, #10/17/98
[Link]M#
I-K
ImportToolbar Method Example
The following example imports a ToolBar
named Toolbar1 that is owned by the Proficy
iFIX WorkSpace.
Dim lErr as Long
lErr =
[Link]
Toolbar(“Toolbar1”, “WorkSpace”)
Initialize Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, and determines if a
specified tag ([Link].D01.F_CV)
requires electronic signature. If required, the
example validates the signature, writes the new
value, and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim nInfo As Integer
Dim NewValue As Variant
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if tag requires electronic
signature
[Link]
"[Link].DO1.F_CV"
[Link] 0,
bSigRequired, nInfo, bVerify,
bContinuousUse
If bSigRequired = True Then
'Validate the signature, write
the new value and send a message
to the audit trail
NewValue = 1
If bVerify = False Then
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example"
Else
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example",
"supervisor1", "GEF", "Verify
Comment Example"
End If
Else
MsgBox "Signature is not required
for this tag."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
InitializeList Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature and determines if a set of
tags require electronic signature.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bValidSig As Boolean
Dim info As Integer
'Create the list of data sources
Dim DataSources As Variant
ReDim DataSources(2) As String
DataSources(0) =
"[Link].TAG1.F_CV"
DataSources(1) =
"[Link].TAG2.F_CV"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'initialize the object and set
data sources
[Link] DataSources
'Is signature required for data
sources
[Link]
4, bSigRequired, info
If bSigRequired Then
'signature is required for this
list
MsgBox “Signature is required.”
Else
'signature is not required for
this list, check info parameter
for reason
MsgBox “Signature is not
required.”
End If
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
InsertPoint Method Example
The following example inserts the point 55,75
at an index of 3 for the Polyline object
Polyline1.
Dim iPoint As FixFloatPoint
Set iPoint = New FixFloatPoint
iPoint.x = 55
iPoint.y = 75
[Link] 3, iPoint
InteractiveExport Method Example
The following example launches the Export
dialog box for the Line/Multiline chart.
Private Sub
CommandButton4_Click()
[Link]
End Sub
IsColorSelectionVisible Method
Example
The following example determines whether the
WorkSpace's Color Selection dialog box is
open.
Dim bIsVisible As Boolean
bIsVisible =
[Link]
le
IsConnected Method Example
The following example determines whether the
VerticalFillPercentage property of the Oval
object Oval1 has a connection assigned to it.
Dim bIsConnected As Boolean
Dim lIndex As Long
Dim lStatus As Long
[Link]
"VerticalFillPercentage",
bIsConnected, lIndex, lStatus
IsEmpty Method Example
The following example determines if the
Lookup object iLookup is empty.
Dim bIsEmpty As Boolean
[Link] bIsEmpty
IsNodeSignEnabled Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, and determines if a
specified tag ([Link].D01.F_CV)
requires electronic signature. If required, the
example validates the signature, writes the new
value, and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim nInfo As Integer
Dim NewValue As Variant
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if tag requires electronic
signature
[Link]
"[Link].DO1.F_CV"
[Link] 0,
bSigRequired, nInfo, bVerify,
bContinuousUse
If bSigRequired = True Then
'Validate the signature, write
the new value and send a message
to the audit trail
NewValue = 1
If bVerify = False Then
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example"
Else
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example",
"supervisor1", "GEF", "Verify
Comment Example"
End If
Else
MsgBox "Signature is not required
for this tag."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
IsSignatureRequired Method
Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, and determines if a
specified tag ([Link].D01.F_CV)
requires electronic signature. If required, the
example validates the signature, writes the new
value, and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim nInfo As Integer
Dim NewValue As Variant
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if tag requires electronic
signature
[Link]
"[Link].DO1.F_CV"
[Link] 0,
bSigRequired, nInfo, bVerify,
bContinuousUse
If bSigRequired = True Then
'Validate the signature, write
the new value and send a message
to the audit trail
NewValue = 1
If bVerify = False Then
[Link]
ue 0, NewValue, "admin", "",
"Perform Comment Example"
Else
[Link]
ue 0, NewValue, "admin", "",
"Perform Comment Example",
"supervisor1", "GEF", "Verify
Comment Example"
End If
Else
MsgBox "Signature is not required
for this tag."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
IsSignatureRequiredForList Method
Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature and determines if a set of
tags require electronic signature.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bValidSig As Boolean
Dim info As Integer
'Create the list of data sources
Dim DataSources As Variant
ReDim DataSources(2) As String
DataSources(0) =
"[Link].TAG1.F_CV"
DataSources(1) =
"[Link].TAG2.F_CV"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'initialize the object and set
data sources
[Link] DataSources
'Is signature required for data
sources
[Link]
4, bSigRequired, info
If bSigRequired Then
'signature is required for this
list
MsgBox “Signature is required.”
Else
'signature is not required for
this list, check info parameter
for reason
MsgBox “Signature is not
required.”
End If
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
IsUserFxg Subroutine Example
The following example determines if the active
document is the UserGlobals page.
Dim bUserFxg As Boolean
bUserFxg = IsUserFxg
Item Method Example
The following example retrieves the Item
object associated with index 2 in the
Procedures collection for the object
CurrentObject.
Dim iItem As Object
Set iItem =
[Link](2)
The following example retrieves the Item
object associated with index 3 in the Lines
collection for the second item in the
Procedures collection for the object
CurrentObject.
Dim iItem As Object
Set iItem =
[Link](2).
[Link](3)
L
ListEvents Method Example
The following example retrieves the number and the
corresponding list of events for the Oval object Oval1.
Private Sub Oval1_Click()
Dim strMsg As String
Dim pvEvents As Variant
Dim iNumEvents As Integer
strMsg = "This object has the
following events: "
[Link] pvEvents,
iNumEvents
For Each i In pvEvents
strMsg = strMsg + i + ","
Next
MsgBox strMsg, vbOKOnly,
"Message"
End Sub
ListMethods Method Example
The following example retrieves the number
and the corresponding list of methods for the
Oval object Oval1.
Dim strMsg As String
Dim pvMethods As Variant
Dim iNumMethods As Integer
[Link] pvMethods,
iNumMethods
strMsg = "This object has the
following Methods: "
For Each i In pvMethods
strMsg = strMsg + i + ","
Next
MsgBox strMsg, vbOKOnly,
"Message"
ListProperties Method Example
The following example retrieves the number
and the corresponding list of properties and
their datatypes for the Oval object Oval1.
Dim strMsg As String
Dim pvProperties As Variant
Dim pvDataTypes As Variant
Dim iNumProps As Integer
[Link]
pvProperties, pvDataTypes,
iNumProps
strMsg = "This object has the
following Properties: "
For Each i In pvProperties
strMsg = strMsg + i + ","
Next
MsgBox strMsg, vbOKOnly,
"Message"
ListWindowsGroupNames Method
Example
The following example retrieves a string aray
of Windows group names for the
SecuritySynchronizer object objSecSynch.
Dim objSecSynch As
SecuritySynchronizer
Set objSecSynch = New
SecuritySynchronizer
Dim bNT4NamesOnly As Boolean
bNT4NamesOnly = True
[Link]
bNT4NamesOnly
Setting the bNT4NamesOnly variable to True
returns only Windows group names that do not
exceed twenty characters.
Load_TS_List Method Example
This example loads the tag status list
TAGSTATUS into the current picture when a
button is pressed.
Private Sub
Button_LoadTSList_Click()
Me.Load_TS_List TAGSTATUS
End Sub
LoadImage Method Example
The following example loads the image
CustomButton10 as the primary image at index
1 for the Bimtap object Bitmap1.
[Link] True, 1,
"C:\Program Files\Proficy\Proficy
iFIX\Local\[Link]"
LoadTagGroupFile Example
The following example loads the tag group file
[Link] into the iFIX picture pic1.
Private Sub
CommandButton1_Click()
[Link]
"[Link]"
End Sub
LocateObject Subroutine Example
The following example finds the object Tank1
in all open documents.
LocateObject "Tank1", False
LogicalToPercentage Method
Example
The following example converts the Top, Left,
Height and Width coordinates from 30, 30,
100, 150 in logical units to percentage of
screen space available for the Picture
TestPicture.
Dim dTop As Double
Dim dLeft As Double
Dim dHeight As Double
Dim dWidth As Double
dTop = 30
dLeft = 30
dHeight = 100
dWidth = 150
[Link]
dTop, dLeft, dHeight, dWidth
LogicalToUserFormPoint Method
Example
The following example converts the Top, Left
coordinates from 30, 50 in logical units to
"UserForm Point" coordinates for the Picture
TestPicture.
Dim dTop As Double
Dim dLeft As Double
dTop = 30
dLeft = 50
[Link]
t dTop, dLeft
LogIn Subroutine Example
The following example opens the login dialog,
allowing the user to perform login/logout
procedures.
LogIn (0) , (False) (by default)
M-N
MakeLinesHorizontal Method
Example
The following example shows how to convert
the selected line object into horizontal line(s).
Set ObjHelper =
BuildObject("GeometryHelper")
Call
[Link]
MakeLinesVertical Method Example
The following example shows how to convert
the selected line object(s) into vertical line(s).
Set ObjHelper =
BuildObject("GeometryHelper")
Call [Link]
MakeSameSize Method Example
The following example selects the Polygon
and Oval objects, Polygon1 and Oval1, and
sets them to have the same width.
[Link] False
[Link] False
[Link] 1
Modify Method Example
The following example displays the Modify
Block dialog box for AI1 of the Bitmap object
Bitmap1.
Dim bReadOnly As Boolean
Dim iStatus As Long
[Link] "Fix32.NODE1.AI1",
bReadOnly, iStatus
ModifyColumnLength Method
Example
The following example sets the number of
characters to be displayed in column 1 of the
Chart Chart1 to 7.
[Link] 1, 7
Move Method Example
The following example moves the object
Tank1 in the horizontal direction by an offset
of 10 and in the vertical direction by an offset
of 25.
[Link] 10, 25
NewAlarm Event Example
The following example parses a list of nodes
and tags for the NewAlarm event:
' parses through the list of new
alarms (there could be more than
one)
Private Sub
AlarmSummaryOCX1_NewAlarm(strNode
As String, strTag As String)
Dim lngNumAlarms&, lngLoop&,
strThisTag$, strThisNode$
' compute the number of new
alarms being sent to us
lngNumAlarms = Len(strTag) / 30
For lngLoop = 1 To lngNumAlarms&
' get the next node and tag
strThisNode = Mid(strNode,
((lngLoop - 1) * 8) + 1, 8)
strThisNode = Trim(strThisNode)
strThisTag = Mid(strTag,
((lngLoop - 1) * 30) + 1, 30)
strThisTag = Trim(strThisTag)
Next lngLoop
End Sub
O
OffScan Subroutine Example
The following example places the block AI1
off scan.
OffScan "AI1"
OnScan Subroutine Example
The following example places the block AI1 on
scan.
OnScan "AI1"
Open Method Example
The following example opens the Picture
TestPicture, displaying it normally.
Dim iDoc As Object
Set
iDoc=[Link]("
C:\Program Files\Proficy\Proficy
iFIX\Pic\[Link]",3)
Open_QT_Pic Method Example
The following example opens a Quick Trend
Picture when a button is pressed. The tags that
are displayed are retrieved from the currently
selected objects.
Private Sub
Button_OpenQTPic_Click()
Me.Open_QT_Pic
End Sub
Open_QT_Pic_Ex Method Example
The following example opens a Quick Trend
Picture when a button is pressed. The tags that
are displayed are retrieved from the currently
selected objects.
Private Sub
Button_OpenQTPic_Click()
Me.Open_QT_Pic_Ex (1)
End Sub
Open_TCP_Pic Method Example
The following example opens the Tag Control
Panel Picture when a button is pressed. The
tags that are displayed are retrieved from the
currently selected objects.
Private Sub
Button_OpenTCPPic_Click()
Me.Open_TCP_Pic
End Sub
Open_TCP_Pic_Ex Method Example
The following example opens the Tag Control
Panel Picture when a button is pressed. The
tags that are displayed are retrieved from the
currently selected objects.
Private Sub
Button_OpenTCPPic_Click()
Me.Open_TCP_Pic_Ex (1)
End Sub
Open_TS_Pic Method Example
The following example opens the Tag Status
Picture for the first found tag for the object
Object1 when a button is pressed. The tags that
are displayed are retrieved from the currently
selected objects.
Private Sub
Button_OpenTSPic_Click()
Object1.Open_TS_Pic
End Sub
Open_TS_Pic_Ex Method Example
The following example opens the Tag Status
Picture for the first found tag for the object
Object1 when a button is pressed. The tags that
are displayed are retrieved from the currently
selected objects.
Private Sub
Button_OpenTSPic_Click()
Object1.Open_TS_Pic_Ex (1)
End Sub
Open_TS_Pic_Type Method Example
The following example opens the Tag Status
Picture TAGSTATUS and displays the tag list
AI, AO, and DI when a button is pressed.
Private Sub
Button_OpenTSPicType_TagStatus_Cl
ick()
Dim SomeStrings(2) As String
Dim OpenedPic As Object
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Set OpenedPic =
Me.Open_TS_Pic_Type(TAGSTATUS,
SomeStrings)
End Sub
The following example opens the Quick Trend
Picture QUICKTREND into the current picture
and displays the tag list AI, AO, and DI when
a button is pressed.
Private Sub
Button_OpenTSPicType_QT_Click()
Dim SomeStrings(2) As String
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Me.Open_TS_Pic_Type
QUICKTREND, SomeStrings
End Sub
The following example opens the Tag Control
Panel Picture TAGCONTROLPANEL into the
current picture and displays the tag list AI,
AO, and DI when a button is pressed.
Private Sub
Button_OpenTSPicType_TCP_Click()
Dim SomeStrings(2) As String
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Me.Open_TS_Pic_Type
TAGCONTROLPANEL, SomeStrings
End Sub
Open_TS_Pic_Type_Ex Method
Example
The following example opens the Tag Status
Picture TAGSTATUS and displays the tag list
AI, AO, and DI when a button is pressed. If
one instance of this picture is already open,
another instance displays.
Private Sub
Button_OpenTSPicType_TagStatus_Cl
ick()
Dim SomeStrings(2) As String
Dim OpenedPic As Object
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Set OpenedPic =
Me.Open_TS_Pic_Type_Ex(TAGSTATUS,
SomeStrings, 1)
End Sub
The following example opens the Quick Trend
Picture QUICKTREND into the current picture
and displays the tag list AI, AO, and DI when
a button is pressed. If one instance of this
picture is already open, another instance
displays.
Private Sub
Button_OpenTSPicType_QT_Click()
Dim SomeStrings(2) As String
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Me.Open_TS_Pic_Type_Ex
QUICKTREND, SomeStrings, 1
End Sub
The following example opens the Tag Control
Panel Picture TAGCONTROLPANEL into the
current picture and displays the tag list AI,
AO, and DI when a button is pressed. If one
instance of this picture is already open, another
instance displays.
Private Sub
Button_OpenTSPicType_TCP_Click()
Dim SomeStrings(2) As String
SomeStrings(0) =
"[Link].A_NAME"
SomeStrings(1) =
"[Link].A_NAME"
SomeStrings(2) =
"[Link].A_NAME"
Me.Open_TS_Pic_Type_Ex
TAGCONTROLPANEL, SomeStrings, 1
End Sub
OpenDigitalPoint Subroutine
Example
The following example opens the block DO1.
OpenDigitalPoint "DO1"
OpenPicture Subroutine Example
The following example opens the Picture
TestPicture, giving it an alias of Test and
positioning its top left corner at (75,75).
OpenPicture "TestPicture"
,"Test", 75, 75
The following example opens another instance
of a picture if it is already open in the iFIX
WorkSpace:
OpenPicture "TestPicture", , , ,
, , , , True
The following example opens another instance
of a picture if it is already open in the iFIX
WorkSpace, but with a different tag group file
(named taglist3):
OpenPicture "TestPicture", , , ,
, , , taglist3, True
The next example shows the OpenPicture
subroutine using the optional intErrormode
parameter, with a value of 0:
OpenPicture "BadPic", , , , 0
When you use 0 for the intErrorMode, if you
try to open a picture that does not exist, a
message box appears whose title is the name of
the picture that made the erroneous call and
whose contents are the error number and error
description. This is the default. If no entry is
made for the intErrorMode parameter, the
default is used.
If you enter a 1 for intErrorMode the error is
raised for you to handle:
OpenPicture "BadPic", , , , 1
Your error handling code would have to look
something like this:
On Error Goto Errorhandler
OpenPicture "BadPic", , , , 1
End Sub
Errorhandler:
Msgbox "my error message" +
Chr(13) + Cstr([Link]) +
Chr(13) + [Link], ,
[Link]
If you enter a 2 for intErrorMode, the error is
sent to all typers, including the Alarm History
window using the SendOperatorMessage
method:
OpenPicture "BadPic", , , , 2
When you use 2 for the intErrorMode, you
provide for silent error tracking.
The following example allows the calling
Picture Test to open a Quick Trend Picture
and display the tag list Strings1.
OpenPicture , , , , , Test,
QuickTrend, Strings1
The following example allows the calling
picture Test to open a Tag Status Picture and
display the tag list Strings2.
OpenPicture , , , , , Test,
TagStatus, Strings2
The following example allows the calling
picture Test to open a Tag Control Panel
Picture and display the tag list Strings3.
OpenPicture , , , , , Test,
TagControlPanel, Strings3
OpenTGDPicture Subroutine
Example
This example opens the picture TestPicture,
gives it an alias of Test, and then open the
taggroup file TestTGD. The coordinates of the
top-left side of the picture are 75, 75.
OpenTGDPicture "TestPicture",
"Test", 75, 75, "TestTGD"
This next example opens the picture
TestPicture, allowing for multiple instances.
The coordinates of the top-left side of the
picture are 75, 75.
OpenTGDPicture "TestPicture", ,
75, 75, , , true
This next example opens the picture
TestPicture, allowing for multiple instances. It
opens the instance with the taggroup file
TestTGD. The coordinates of the top-left side
of the picture are 75, 75.
OpenTGDPicture "TestPicture", ,
75, 75, "TestTGD", , true
P-Q
ParseConnectionSource Method
Example
The following example parses the AI1.F_CV
source to the VerticalFillPercentage property
of Oval Oval1 to determine the validity of the
data source.
Dim iStatus As Long
Dim validObjs As Variant
Dim UndObjs As Variant
Dim FQSource As String
[Link]
"VerticalFillPercentage",
"AI1.F_CV", iStatus, validObjs,
UndObjs, FQSource
Paste Method Example
The following example pastes the Oval object
Oval1 to the Picture TestPicture after copying
it to the clipboard.
[Link]
[Link]
[Link]
PasteSpecial Method Example
The following example opens the Paste Special
dialog box for the Picture TestPicture.
[Link]
Pause Method Example
The following example pauses the Chart
Chart1.
[Link]
PauseAlarmRead Method Example
The following example pauses the Alarm
Summary object prior to copying alarms to
list.
' pause alarm read so nothing is
added, deleted or moved
[Link]
lngTotalFiltered =
[Link]
rms
[Link]
For lngLoop = 1 To
lngTotalFiltered
[Link]
lngLoop, True
[Link]
ag strNode, strTag
[Link] strNode & "." &
strTag
[Link]
lngLoop, False
Next lngLoop
' resume alarm read
[Link]
PercentageToLogical Method
Example
The following example converts the Top, Left,
Height and Width coordinates from 30, 30,
100, 150 in percentage of screen space
available to logical units for the Picture
TestPicture.
Dim dTop As Double
Dim dLeft As Double
Dim dHeight As Double
Dim dWidth As Double
dTop = 30
dLeft = 30
dHeight = 100
dWidth = 150
[Link]
dTop, dLeft, dHeight, dWidth
PercentageToPixel Method Example
The following example converts the Top, Left,
Height and Width coordinates from 30, 30,
100, 150 in percentage of screen space
available to pixels for the Picture TestPicture.
Dim dTop As Double
Dim dLeft As Double
Dim dHeight As Double
Dim dWidth As Double
dTop = 30
dLeft = 30
dHeight = 100
dWidth = 150
[Link]
dTop, dLeft, dHeight, dWidth
PictureAlias Subroutine Example
The following example assigns the alias
TestPicAlias to the current Picture.
PictureAlias "TestPicAlias"
ClosePicture "TestPicAlias"
PixelToPercentage Method Example
The following example converts the Top, Left,
Height and Width coordinates from 30, 30,
100, 150 in pixels to percentage of screen
space available for the Picture TestPicture.
Dim dTop As Double
Dim dLeft As Double
Dim dHeight As Double
Dim dWidth As Double
dTop = 30
dLeft = 30
dHeight = 100
dWidth = 150
[Link]
dTop, dLeft, dHeight, dWidth
PrintChart Method Example
The following example prints the
Line/Multiline chart to the size of a full page
of paper.
Private Sub
CommandButton4_Click()
[Link]
SizeUnits_FullPage
End Sub
PrintOut Method Example
The following example opens the print dialog
for the active Document.
Dim bPrinted as boolean
bPrinted =
[Link]
ut
PrintReport Subroutine Example
The following example prints 3 copies of
pages 1 through 5 of the report TestReport,
collating each copy.
PrintReport "TestReport", False,
3, True, 1, 5
PromptToChangePassword Method
Example
The following example checks the user’s
Windows account expiration status. If the
account expired, this example prompts the user
to change his password (if he has rights to do
so). If the account has not expired, a message
appears stating how many days are left until
the password expires.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim UserName As String
Dim PassWord As String
Dim UsrId As String
Dim bExpired As Boolean
Dim daysLeft As Long
Dim bCanChangePassword As Boolean
'user name of an iFix user using
Windows security
UserName = "expire"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check account status and user’s
right to change password
[Link]
UserName, bExpired,
bCanChangePassword, daysLeft
If bExpired <> False Then
If bCanChangePassword <> False
Then
[Link]
UserName
End If
Else
'password is not expired
MsgBox "Password is due to expire
in " & daysLeft & " days."
End If
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
QuickAdd Subroutine Example
The following example gets the status of the
block NewBlock to the database. If NewBlock
doesn't exist, the QuickAdd dialog will be
opened, allowing the user to configure the
block on the fly.
Dim iStatus As Integer
iStatus = QuickAdd("NewBlock1")
Quit Method Example
The following example shuts down the
WorkSpace, prompting the user to save
changes made to any open documents.
[Link] 3
R
RampValue Subroutine Example
The following example ramps the block AO1
by 25 percent of its EGU range.
RampValue "25", True, "AO1"
The following example ramps the block AO1
by a value of 15.
RampValue "15", False, "AO1"
Read Method Example
The following example:
• Creates a data system ocx FDS;
• Adds a data Group DataGroup1 to the
Groups collection;
• Adds a DataItem to the DataItems
collection;
• Reads the Group DataGroup1;
• Reads the DataItem
'Create the Data System OCX
Dim FDS As Object
Set FDS =
CreateObject("[Link]
llution FD Data System Control")
'Add a group to the Groups
collection
[Link] ("DataGroup1")
[Link]("DataGroup1").Dat
[Link]("[Link].AI1.F_
CV")
'Read DataGroup1
[Link]("DataGroup1").Rea
d
'Read the DataItem
[Link]("DataGroup1").Dat
[Link](1).Read
ReadValue Subroutine Example
The following example reads the value of the
block AI1.
Dim lValue As Variant
lValue = ReadValue("AI1")
Refresh Method Example
The following example repaints the Rectangle
object Rect1.
[Link]
RefreshChartData Method Example
The following simple example refreshes the
data being displayed in the Chart1, which is a
HistogramChart, LineChart, or SPCBarChart
object.
[Link]
The following example shows a refresh of an
Enhanced Chart, LineChart1, after scroll
forward of 50% is performed on the Enhanced
Chart.
Dim dtTime As Variant
Dim dtDate As Variant
Dim dInterval As Long
' set scroll percentage
dInterval =
[Link]
dInterval = dInterval * 0.5 '
50%
'scroll time
dtTime =
[Link]
dtTime = DateAdd("s",
dInterval, dtTime)
[Link]
= dtTime
' scroll date
dtDate =
[Link]
dtDate = DateAdd("s",
dInterval, dtDate)
[Link]
= dtDate
'refresh chart
[Link]
The second example above requires a
reference to the historical data set named “iFIX
HistoricalDataSet Object v 1.0 Type Library”
in your VBA project.
RegCloseKey Subroutine Example
The following example is the actual
PrintReport subroutine from FactoryGlobals
global subroutines. Here, we implement late
binding to run Crystal Reports. First, find out
if Crystal Reports is installed on the user's
machine with RegOpenKeyEx. If it is, we
create an instance of it. Then, we close the
registry key with RegCloseKey.
NOTE: This example does not apply to Crystal
XI; it applies to an earlier version, such as
Crystal 7. For Crystal XI, use the PrintReport
subroutine instead. The PrintReport subroutine
will do all of the registry entries for you.
Public Sub PrintReport(ByVal
Report As String, Optional Prompt
As Boolean, Optional ByVal Copies
As Long, Optional ByVal Coll As
Boolean, Optional ByVal StartNo
As Long, Optional ByVal EndNo As
Long)
Dim CrystalApplication As Object
Dim CrystalReport As Object
Dim lngResult As Long
Dim lngRes As Long
On Error GoTo ErrorHandler
'Check if Crystal Reports is
installed.
lngResult =
RegOpenKeyEx(&H80000000,
"CrystalReports", &O0, &H20000,
lngRes)
'If it is, create an instance of
it.
If lngResult = 0 Then
Set CrystalApplication =
CreateObject("[Link]
ation")
'If not, send the user a message.
Else
MsgBox "You do not have Crystal
Reports installed."
End
End If
'Close the registry key.
lngResult =
RegCloseKey(&H80000000)
Set CrystalReport =
[Link](Rep
ort)
[Link] Prompt,
Copies, Coll, StartNo, EndNo
Exit Sub
ErrorHandler:
HandleError
End Sub
RegOpenKeyEx Subroutine Example
The following example is the actual
PrintReport subroutine from FactoryGlobals
global subroutines. Here, we implement late
binding to run Crystal Reports. First, find out
if Crystal Reports is installed on the user's
machine with RegOpenKeyEx. If it is, we
create an instance of it. Then, we close the
registry key with RegCloseKey.
NOTE: This example does not apply to Crystal
XI; it applies to an earlier version, such as
Crystal 7. For Crystal XI, use the PrintReport
subroutine instead. The PrintReport subroutine
will do all of the registry entries for you.
Public Sub PrintReport(ByVal
Report As String, Optional Prompt
As Boolean, Optional ByVal Copies
As Long, Optional ByVal Coll As
Boolean, Optional ByVal StartNo
As Long, Optional ByVal EndNo As
Long)
Dim CrystalApplication As Object
Dim CrystalReport As Object
Dim lngResult As Long
Dim lngRes As Long
On Error GoTo ErrorHandler
'Check if Crystal Reports is
installed.
lngResult =
RegOpenKeyEx(&H80000000,
"CrystalReports", &O0, &H20000,
lngRes)
'If it is, create an instance of
it.
If lngResult = 0 Then
Set CrystalApplication =
CreateObject("[Link]
ation")
'If not, send the user a message.
Else
MsgBox "You do not have Crystal
Reports installed."
End
End If
'Close the registry key.
lngResult =
RegCloseKey(&H80000000)
Set CrystalReport =
[Link](Rep
ort)
[Link] Prompt,
Copies, Coll, StartNo, EndNo
Exit Sub
ErrorHandler:
HandleError
End Sub
Remove Method Example
The following example gets the index number
for the Click of the object CurrentObject and,
if a procedure exists, removes it.
Dim lIndex As Long
Dim lFound As Long
[Link]
HandlerIndex "Click", lIndex,
lFound
If lFound = 1 Then
[Link] lIndex
End If
The following example removes the
Group DataGroup1 from the Groups
collection of the FixDataSystem
FDS.
[Link]("DataGroup1")
The following example removes the
first Group from the Groups
collection of the FixDataSystem
FDS.
[Link](1)
RemoveAll Method Example
The following example removes all the lines of
code from the Click event of the object Rect2
in the active document.
Dim o As Object
Dim oProc As Object
Dim lIndex As Long
Dim lFound As Long
Set o =
[Link].F
indObject("Rect2")
[Link]
"Click", lIndex, lFound
If (lFound) Then
Set oProc =
[Link](lIndex)
[Link]
End If
RemoveAllLevels Method Example
The following example removes all levels in
the Lookup object iLookup.
[Link]
RemoveItem Method Example
The following example removes the first
column from the Chart Chart1.
[Link] 1
RemoveLegendItem Method Example
The following example removes the value
column from the Chart Chart1.
[Link] "Value"
RemoveLevel Method Example
The following example removes level 4 from
the Lookup object Lookup1.
[Link] 4
RemoveObject Method Example
The following example removes the Timer
object MyTimer from the Schedule
TestSchedule and then refreshes the Schedule
so that the Timer object is no longer
displayed.
[Link]
"MyTimer"
[Link]
scHREFreshView
ReplacePicture Subroutine Example
The following example replaces the Picture
TestPicture with TestPicture1.
ReplacePicture "TestPicture1",
"TestPicture"
The following example allows the calling
picture TestPicture to replace the active Quick
Trend Picture with QuickTrend1 and display
the tag list Strings1.
ReplacePicture , , , , ,
TestPicture, QuickTrend1,
Strings1
The following example allows the calling
picture TestPicture to replace the active Tag
Status Picture with TagStatus1 and display the
tag list Strings2.
ReplacePicture , , , , ,
TestPicture, TagStatus1, Strings2
The following example allows the calling
picture TestPicture to replace the active Tag
Control Panel Picture with TagControlPanel1
and display the tag list Strings3.
ReplacePicture , , , , ,
TestPicture, TagControlPanel1,
Strings3
RemovePictureFromStartupList
Example
The following example removes the Picture
named [Link] (in the D:\Program
Files\Proficy\Proficy iFIX\PIC directory) from
the Configuration environment's startup list of
the Proficy iFIX WorkSpace.
Dim lErr as Long
lErr =
[Link]
ePictureFromStartupList_
("D:\Program
Files\Proficy\Proficy
iFIX\pic\[Link]", False)
Note that the full path is required for the
picture. Also note that the second paramater,
when set to FALSE, removes the picture from
the Configuration environment's startup list.
When set to TRUE, it removes the picture
from the Runtime environment's startup list.
Replace_QT_Pic Method Example
The following example replaces the current
picture with a Quick Trend picture when a
button is pressed. The tags that are displayed
are retrieved from the currently selected
objects.
Private Sub
Button_ReplaceQTPic_Click()
Me.Replace_QT_Pic
End Sub
Replace_TCP_Pic Method Example
The following example replaces the current
picture with a Tag Control Panel picture when
a button is pressed. The tags that are displayed
are retrieved from the currently selected
objects.
Private Sub
Button_ReplaceTCPPic_Click()
Me.Replace_TCP_Pic
End Sub
Replace_TS_Pic_Type Method
Example
The following example replaces the current
picture Pic1 with the Quick Trend picture
QTPic1 and the tag list Strings1.
Pic1.Replace_TS_Pic_Type QTPic1,
Strings1
The following example replaces the current
picture Pic1 with the Tag Status picture
TSPic1 and the tag list Strings2.
Pic1.Replace_TS_Pic_Type TSPic1,
Strings2
The following example replaces the current
picture Pic1 with the Tag Control Panel picture
TCPPic1 and the tag list Strings3.
Pic1.Replace_TS_Pic_Type TCPPic1,
Strings3
Replace_TS_Pic Method Example
The following example replaces the current
picture with a Tag Status picture when a button
is pressed. The tags that are displayed are
retrieved from the currently selected objects.
Private Sub
Button_ReplaceTSPic_Click()
Me.Replace_TS_Pic
End Sub
ReplaceDocument Method Example
The following example replaces the active
Document with TestPicture.
[Link]
ocument "C:\Program
Files\Proficy\Proficy
iFIX\Pic\[Link]"
ReplaceInString Method Example
The following example finds each occurrence
of the string AI1 with the string
FIX32.NODE1.AI1.F_CV by calling
FindInString and then uses the lFirst, lCount
parameter return values to replace AI1 with
AI2, returning the new string in the
sReplacement parameter. The operation is
specified to include scripts in the search.
Dim lFirst As Long
Dim lCount As Long
Dim sMatchString As String
Dim bFound As Boolean
Dim bsuccess As Boolean
Dim sTarget As String
Dim sReplacement As String
sTarget = "FIX32.NODE1.AI1.F_CV"
[Link]
"FIX32.NODE1.AI1.F_CV", 1, "AI1",
8, sMatchString, lFirst, lCount,
bFound
[Link]
sTarget, "AI2", sMatchString,
lFirst, lCount, 8, sReplacement,
bsuccess
ReplaceTGDPicture Subroutine
Example
This example replaces the open picture
TestPicture with TestPicture1 and then opens
the tag group file TestTGD.
ReplaceTGDPicture "TestPicture1",
"TestTGD", "TestPicture"
ResetChartData Method Example
The following example resets the data being
displayed for the Chart Chart1.
[Link]
ResetObjectStats Method Example
The following example resets the statistics for
all Event objects in the Schedule
TestSchedule.
[Link] 2
The following example resets the statistics for
the Timer MyTimer in the Schedule
TestSchedule.
[Link]
"MyTimer"
The following example resets the statistics for
the Timer objects TestTimer, TestTimer1,
TestTimer2 in the Schedule TestSchedule.
Dim objects(2) As Variant
objects(0) = "TestTimer"
objects(1) = "TestTimer1"
objects(2) = "TestTimer2"
[Link]
objects
ResetStats Method Example
The following example resets the statistics for
the Timer object iTimer to zero.
[Link]
ResetZoom Method Example
The following example resets the Chart
Chart1 to display its default viewing area.
[Link]
ResolveTagGroupFile Example
The following example resolves the tag group
file [Link] in the iFIX picture pic1.
[Link]
"[Link]"
The ResolveTagGroupFile method is a
Configuration environment method that loops
through the tag groups referenced in the
picture, perform the substitutions, and persist
the information. Using this method provides
you with a faster load time.
Resume Method Example
The following example resumes the Chart
Chart1.
[Link]
ResumeAlarmRead Method Example
The following example resumes updating the Alarm
Summary object after to copying alarms to list.
' pause alarm read so nothing is
added, deleted or moved
[Link]
lngTotalFiltered =
[Link]
rms
[Link]
For lngLoop = 1 To
lngTotalFiltered
[Link]
lngLoop, True
[Link]
ag strNode, strTag
[Link] strNode & "." &
strTag
[Link]
lngLoop, False
Next lngLoop
' resume alarm read
[Link]
RetrieveDefinition Method Example
The following example retrieves the
definitions contained in a tag group file.
Dim sTokenList() as String,
TokenList as Variant
Dim sReplacementList() as String,
ReplacementList as Variant
Dim sDescriptionList() as String,
DescriptionList as Variant
' Create the tag group file
object
Dim TGD As Object
Set TGD =
CreateObject("TagGroupDefinitionI
[Link]
erface")
[Link] "Test", 2,
TokenList, ReplacementList,
DescriptionList
RetrieveTagGroupVariables Method
Example
Used to retrieve all of the tag group symbols
referenced in the picture. This does include
scripts but does not include Forms. An array of
strings is returned.
Dim iCount As Integer
Dim vaSymbols As Variant
[Link]
iCount, vaSymbols
Rotate Method Example
The following example rotates the Polygon
object Polygon1 by 45 degrees.
[Link] 45, False
RunObject Method Example
The following example runs all Timer objects
in the Schedule TestSchedule.
[Link] 1
The following example runs the Timer
MyTimer in the Schedule TestSchedule.
TestSchedule. RunObject "MyTimer"
The following example runs the Timer objects
TestTimer, TestTimer1, TestTimer2 in the
Schedule TestSchedule.
Dim objects(2) As Variant
objects(0) = "TestTimer"
objects(1) = "TestTimer1"
objects(2) = "TestTimer2"
TestSchedule. RunObject objects
S
Save Method Example
The following example saves all open
documents in the WorkSpace, prompting the
user for each Document.
Dim iStatus As Long
iStatus =
[Link](True)
The following example opens the
Document TestPicture and saves it
as TestPicture1 without prompting
the user.
Dim iDoc As Object
Set iDoc =
[Link]("C:\Pr
ogram Files\Proficy\Proficy
iFIX\pic\[Link]")
[Link] "[Link]",
False
Save_TS_List Method Example
The following example saves the tag status list
displayed in the current picture when a button
is pressed.
Private Sub
Button_SaveTSList_Click()
Me.Save_TS_List
End Sub
SaveAsSVG Method Example
The following example opens the Document
TestPicture and saves it as [Link].
Private Sub
CommandButton1_Click()
Dim iDoc As CFixFileLink
Set iDoc =
[Link]("C:\Pr
ogram Files\Proficy\Proficy
iFix\pic\[Link]")
[Link]
"C:\Program Files\Proficy\Proficy
iFix\pic\[Link]", iDoc
End Sub
SaveToHistoryList Method Example
The following example saves the item
"AI1.F_CV" to the history list for the
ExpressionEditor object ExpressionEditor1.
Dim iIndex As Integer
iIndex =
[Link]
st("AI1.F_CV")
ScrollBack Method Example
The following example scrolls back in the
Chart Chart1 by the current value of its
ScrollPercentage property.
[Link]
ScrollForward Method Example
The following example scrolls forward in the
Chart Chart1 by the current value of its
ScrollPercentage property.
[Link]
ScrollTimeBack Method Example
The following example scrolls the Pen Pen1
back by the current value of its
ScrollPercentage property.
[Link]
ScrollTimeForward Method Example
The following example scrolls the Pen Pen1
forward by the current value of its
ScrollPercentage property.
[Link]
Select Method Example
The following example selects the the Oval
Oval1.
[Link]
SelectAlarmRow Method Example
The following example shows how to select
and deselect a row of the Alarm Summary
object.
' pause alarm read so nothing is
added, deleted or moved
[Link]
lngTotalFiltered =
[Link]
rms
[Link]
For lngLoop = 1 To
lngTotalFiltered
[Link]
lngLoop, True
[Link]
ag strNode, strTag
[Link] strNode & "." &
strTag
[Link]
lngLoop, False
Next lngLoop
' resume alarm read
[Link]
SelectAll Method Example
The following example selects all of the
objects in the Picture TestPicture.
[Link]
SelectObject Method Example
The following example selects both the
Polyline object, Polyline1, and the Oval
object, Oval1.
[Link] False
[Link] False
The following example selects
only Oval1.
[Link] True
[Link] True
SendOperatorMessage Method
Example
The following example sends a message to
node NODE1.
[Link]
"Something has occurred", "NODE1"
SendSignedOperatorMessage
Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, displays the Electronic
Signature dialog box, validates the signature
and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim bValidSig As Boolean
Dim PerformUserName As String
Dim PerformUserID As String
Dim PerformComment As String
Dim PerformFullName As String
Dim VerifyUserName As String
Dim VerifyUserID As String
Dim VerifyComment As String
Dim VerifyFullName As String
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
bVerify = True ' verification is
not required
bContinuousUse = True ' allow
continuous user, if any, to be
displayed in the dialog box
bValidSig = False ' will be set
to TRUE by GetSignature if
signature is captured
successfully
'Display the Electronic Signature
dialog box
[Link] "Action
Description", bVerify,
bContinuousUse, bValidSig,
Ucase(PerformUserName),
Ucase(PerformUserID),
PerformComment,
Ucase(VerifyUserName),
Ucase(VerifyUserID),
VerifyComment
If bValidSig = True Then
'Send a message to the audit
trail
[Link]
"Action Description", "", "",
Ucase (PerformUserID),
PerformComment,
Ucase(VerifyUserID),
VerifyComment
'Get the full names of the
signers
[Link]
Ucase(PerformUserID),
Ucase(PerformFullName)
[Link]
Ucase(VerifyUserID),
Ucase(VerifyFullName)
'Show Results
MsgBox "Action performed by " +
PerformUserName + " (" +
PerformFullName + ") " +
PerformComment + " and verified
by " + VerifyUserName + " (" +
VerifyFullName + ") " +
VerifyComment
Else
MsgBox "Signature was not
captured."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
SendToBack Method Example
The following example selects the Oval object
Oval1 contained within the Picture
TestPicture and sends it to the back of the
stacking order.
[Link]
[Link]
SetAuto Subroutine Example
The following example sets the block AI1 to
automatic mode.
SetAuto "AI1"
SetContinuousUser Method Example
The following example ensures that the User
Name entered is valid, creates the ESignature
object, checks that the node is enabled for
electronic signature, and sets and gets the
name of the continuous user.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim UserName As String
Dim SetName As String
'valid user name
SetName = "TestUser"
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignature")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Set the name of the continuous
user to "TestUser"
[Link] SetName
'Get the name of the continuous
user
[Link] UserName
MsgBox “Continuous user: ” &
UserName
Else
'the hardware key is not enabled
for signature, security is
disabled, or bypass signature is
in effect
MsgBox “Signature is not enabled
on this node.”
End If
SetCurrentValue Method Example
The following example sets the current value
for the Pen Pen1.
[Link] 25, #4/13/98
[Link] PM#, 192
SetDispatch Method Example
Reserved for internal purposes.
SetDispid Method Example
Reserved for internal purposes.
SetDuration Method Example
The following example sets the Duration of
the Chart Chart1 to be 1 hour and 35 minutes.
[Link] 0, 1, 35, 0
SetFocusToComboBox Method
Example
The following example sets the focus to the
combobox portion of the ExpressionEditor
object, ExpressionEditor1.
[Link]
Box
SetGlobalMovingEndTimeToCurrent
Method Example
The following example sets the
[Link] property to the current
system time.
Private Sub Group4_Click()
[Link]
rrent
End Sub
SetIndirectionInfo Method Example
Reserved for internal purposes.
SetInterval Method Example
The following example sets the interval of the
Chart Chart1 to be 5 minutes and 30 seconds.
[Link] 0, 0, 5, 30
SetManual Subroutine Example
The following example sets the block AI1 to
manual mode.
SetManual "AI1"
SetLegendMask Method Example
The following example causes all of the potential
legend items for the Enhanced Chart to display.
Private Sub
CommandButton12_Click()
Dim objDataSet As Object '
[Link]
aSet
Set objDataSet =
[Link]()
With objDataSet
.SetLegendMask IIf(0 =
.DSLegendMask, LegendMask_All, 0)
End With
End Sub
SetNumericFormat Method Example
The following example formats the display of
the Format object Format1, displaying 3
whole digits, 3 decimal digits and setting the
justification to Right.
[Link] 3, 3, 2
SetPenDataArray Method Example
The following is an example on how to pass in
arrays of user defined data to create a static
Pen in a Chart.
Dim iWrkSpace As Workspace
Dim db_var_name As Database
Dim record_var As Recordset
Dim iCount As Integer
Dim dVal As Variant
Dim dtDate As Variant
Dim lQual As Variant
Dim iResult As Integer
Set iWrkSpace =
CreateWorkspace("", "admin", "",
dbUseJet)
Set db_var_name =
[Link]("[Link]
")
Set record_var =
db_var_name.OpenRecordSet("Data
Query", dbOpenDynaset)
record_var.MoveLast
iCount = record_var.RecordCount
record_var.MoveFirst
Dim iRow As Integer
Dim iCol As Integer
Dim Value(500) As Double
Dim Times(500) As Date
Dim Quality(500) As Long
Dim i As Integer
For i = 0 To iCount - 1
Value(i) =
record_var.Fields("Value").Value
Times(i) =
record_var.Fields("Time").Value
Quality(i) =
record_var.Fields("Quality").Valu
e
'Quality(i) should be set to 192
(good data quality) in order to
show data
record_var.MoveNext
Next i
db_var_name.Close
dVal = Value
dtDate = Times
lQual = Quality
Call [Link](iCount,
dVal, dtDate, lQual)
SetPointAt Method Example
The following example modifies the location
of the point at index 2 to the point 75,10 for
the Polygon object Polygon1.
Dim iPoint As FixFloatPoint
Set iPoint = New FixFloatPoint
iPoint.x = 75
iPoint.y = 10
[Link] 2, iPoint
SetPriorityColor Method Example
The following example sets the color to
display for each alarm priority in the
AlarmSummary object AlarmSummaryOCX1.
Dim lGreen As OLE_COLOR
Dim lBlue As OLE_COLOR
Dim lRed As OLE_COLOR
lGreen = 57344
lBlue = 16722988
lRed = 725759
[Link]
7, lGreen
[Link]
6, lBlue
[Link]
5, lRed
SetProperty Method Example
The following example sets the FillStyle
property of the Oval object Oval1 to 3.
[Link] "FillStyle", 3
SetScriptWindow Method Example
The following example instantiates the Visual
Basic editor for the Oval object Oval1
contained within the Picture TestPicture,
displaying the prototype for its MouseDown
event.
[Link]
[Link] True,
"MouseDown"
SetSource Method Example
The following example sets the data source for
the Linear object Linear1 to AI1, specifying
to use the data source if it doesn't exist in the
database, setting the UpdateRate to 1 and the
Deadband to 5.
[Link] "ai1.f_cv",
True, 1, 5
SetStatusColor Method Example
The following example sets the color to
display for alarms with a LOLO status in the
AlarmSummary object AlarmSummaryOCX1.
Dim lGreen As OLE_COLOR
lGreen = 57344
[Link]
1, lGreen
SetStatusFont Method Example
The following example sets the font to display
for alarms with a HIHI status in the
AlarmSummary object AlarmSummaryOCX1.
It sets the font to be displayed as Bold
Garamond with the Strikethrough option set to
True.
[Link] 2,
"Garamond", True, False, True,
False
SetStringFormat Method Example
The following example sets the raw formatting
of the Format object for the Datalink
Datalink1 contained in Picture TestPicture.
Dim iFormat As Object
Set iFormat =
[Link]("Datalink1
.Format1")
[Link] "Value =
%s"
SetTabSelection Method Example
The following example displays the
Fix32Database, Pictures and Globals for the
ExpressionEditor ExpressionEditor1.
Dim bResult as boolean
bResult =
[Link]
(11)
SetTimeBeforeNow Method Example
The following example sets the time for the
Chart Chart1 to be 2 hours and 30 minutes
before the current time.
[Link] 2, 30, 0
SetTimeCursorTime Method Example
The following example sets the time cursor
time for the first Pen in the Pens collection of
the Chart Chart1 to be 11/15/98 at 1:30PM.
[Link]
#11/15/98 [Link] PM#, 1
SetWindowLocation Method Example
The following example sets the location of the
Picture TestPicture by setting the top
percentage to 10, the left percentage to 10 and
setting the height and width percentages both
to 200, without redrawing the document after
setting the window's location.
[Link] 10,
10, 200, 200, False
ShellExecute Subroutine Example
The following example opens Notepad.
Dim lResult As Long
lResult = ShellExecute(hWnd,
"Open", "[Link]",
vbNullString, "c:\temp", 4)
ShowAnimations Method Example
The following example opens the Animation
dialog for the Oval object Oval1.
[Link]
[Link]
ShowBrowseDialog Method Example
The following example opens Expression
Editor dialog box for the ExpressionEditor
object ExpressionEditor1.
[Link]
ShowColorBox Method Example
The following example opens the color dialog
box for the ColorButton object ColorButton1.
[Link]
ShowColorSelection Method Example
The following example opens the color
selection dialog box for the Picture
TestPicture.
[Link]
True
ShowCustomPages Method Example
The following example opens the custom
configuration dialog for the Chart Chart1.
[Link]
ShowPipePreviewDialog Method
Example
This example opens the Modify Pipe
Characteristics dialog box for the selected pipe
object(s).
Set ObjHelper =
BuildObject("GeometryHelper")
Call
[Link]
ShowTaskWizard Method Example
The following example opens the Workspace's
Task Wizard dialog box.
[Link]
ShowVBAProcedure Method Example
This example sets the focus of the VBA script
window to the Click event of Rect2 when
Rect2 is contained in the active document.
Dim oPic As Object
Dim oRect As Object
Set oPic =
[Link]
Set oRect =
[Link]("Rect2")
[Link] "Click",
oRect
ShowVisualBasicEditor Method
Example
The following example opens the Workspace's
Visual Basic Editor.
[Link]
AlarmHornSilence Example
This example silences the alarm horn.
Private Sub Button1_Click ()
AlarmHornSilence
End Sub
SnapObjectsToGrid Method Example
The following example snaps the Oval and
Datalink objects, Oval1 and Datalink1, to
grid.
[Link] False
[Link] False
[Link]
SpaceEvenly Method Example
The following example spaces the Oval,
Polygon, and RoundRectangleobjects Oval1,
Polygon1 and RoundRect1 with equal
horizontal spacing between them.
[Link] False
[Link] False
[Link] False
[Link] 0
StartEvent Method Example
The following example starts the firing of
Event object FixEvent1 of the Schedule
TestSchedule.
Dim iEvent As Object
Set iEvent =
[Link]("TestSchedule.F
ixEvent1")
[Link]
StartTimer Method Example
The following example starts the firing of
Timer object FixTimer1 of the Schedule
TestSchedule.
Dim iTimer As Object
Set iTimer =
[Link]("TestSchedule.F
ixTimer1")
[Link]
StickToCursor Method Example
The following example creates a Rectangle
object and specifies that the object stick to the
cursor upon creation.
Dim iRect As Object
Set iRect =
[Link].B
uildObject("rect")
[Link] = 3#
[Link] = 3#
[Link]
StopEvent Method Example
The following example stops the firing of
Event object FixEvent1 of the Schedule
TestSchedule.
Dim iEvent As Object
Set iEvent =
[Link]("TestSchedule.F
ixEvent1")
[Link]
StopTimer Method Example
The following example stops the firing of
event object FixTimer1 of the Schedule
TestSchedule.
Dim iTimer As Object
Set iTimer =
[Link]("TestSchedule.F
ixTimer3")
[Link]
Stretch Method Example
The following example scales the Oval Oval1
by a horizontal scale percentage of 10 and a
vertical scale percentage of 20.
[Link] 10, 20
SwitchLanguage Method Examples
The following example sets the language of the
displayed text to Spanish for the active picture.
[Link] = 1034
[Link]
- OR -
[Link] (ES_Spanish)
NOTE: For a list of the ID numbers
representing each language, refer to the
Language Letter Acronyms table in the
Exporting and Importing Language Files
topic.
The following example shows how you to
switch the language on only the
AlarmSummary object, by clicking a rectangle
in run mode.
Private Sub Rect1_Click()
[Link]
ge RU_Russian
End Sub
SwitchMode Method Example
The following example sets the mode of the
WorkSpace to run mode.
[Link] 4
SynchronizeSecurity Method
Example
Before you can use the following example, you
must first add a VBA reference to
[Link].
To add a VBA reference to
[Link]:
1. In the Visual Basic Editor, from the
Tools menu, select References. The
VBA References dialog box appears.
2. Click the Browse button and select the
iFIX installation directory (normally
C:\Program Files\Proficy\Proficy
iFIX).
3. Select the
[Link] file and
click Open. A checked
SecuritySynchronizerDLL reference is
added in the VBA References dialog
box.
4. Click OK, then exit the Visual Basic
Editor.
This example creates the
SecuritySynchronizer object and calls the
SynchronizeSecurity method.
Dim objSecSynch as
SecuritySynchronizer
Set objSecSynch = New
SecuritySynchronizer
[Link] =
True
[Link]
This method runs the security synchronization
process.
Before calling the SynchronizeSecurity
method, you must set either one or both of the
following properties to True:
• UseLocalSecurity
• UseDomainSecurity
If you set the UseDomainSecurity property to
True, you must also set the Domain property
to a valid Windows domain name.
T
TagGroupSubstitution Method
Example
This example retrieves the substitution value
of the tag group symbol @tag1@.
Dim szSubstitution As String
[Link]
"@tag1@", szSubstitution
This method looks in the currently loaded tag
group file for the tag and retrieves the
substitution. The TagGroupSubstitution
method is only available in the Runtime
environment. If you pass it a string that is not a
tag group symbol, it will return the same
string.
TagGroupValue Method Example
This example retrieves the value of the tag
group substitution of the tag group symbol
@tag1@.
Dim vaValue As Variant
[Link] "@tag1@",
vaValue
This Runtime-only method looks in the
currently-loaded tag group file to find the
substitution for the passed tag and reads the
current value. Calling this method is similar to
calling the TagGroupSubstitution method,
finding the Object based on the returned string,
and then reading the value. If you pass it a
string that is not a tag group symbol, it will
return the same string.
ToggleDigitalPoint Subroutine
Example
The following example toggles the block DO1
between open and closed.
ToggleDigitalPoint "DO1"
ToggleManual Subroutine Example
The following example toggles the block AI1
between manual and automatic modes.
ToggleManual "AI1"
ToggleScan Subroutine Example
The following example toggles the scan status
of the block AI1.
ToggleScan "AI1"
U
UIActivate Method Example
The following example sets CommandButton1
to its custom active mode.
[Link]
UIDeActivate Method Example
The following example sets CommandButton1
to its custom inactive mode.
[Link]
Undo Method Example
The following example undoes the last action
completed in the Picture TestPicture.
[Link]
UndoTransaction Method Example
The following example starts an undo
transaction for the Picture TestPicture.
[Link]
pUndoTransactionStart
UndoZoom Method Example
The following example restores the
Line/Multiline chart to its default size.
Private Sub
CommandButton9_Click()
[Link]
End Sub
UnGroup Method Example
The following example ungroups the selected
group in the Picture TestPicture.
[Link]
UnloadTagGroupFile Method
Example
The following example unloads the currently
loaded tag group file from the iFIX picture
pic1.
Private Sub
CommandButton1_Click()
[Link]
End Sub
Update_A_Dynamo_By_Name
Method Example
The following code provides an example of the
Update_A_Dynamo_By_Name method. This
example is similar to the one that appears in
the Update_A_Dynamo_By_Ref Method
Example.
Public Function
UpdateADynamo(DynamoInstanceFully
QualifiedName As String,
MasterDynamoFullyQualifiedName As
String, ByRef strReturnMsg) As
UpdateDynamoResult
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If
g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
'////// actual update call
' call Update A Dynamo
[Link]
j.Update_A_Dynamo_By_Name
MasterDynamoFullyQualifiedName,
DynamoInstanceFullyQualifiedName,
iDataSourceOption,
[Link](4069),
iResult
' get a result string
strReturnMsg =
[Link]
t_Last_Result_String
' get the last user choice
from the prompt
If
(g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE) And _
(g_ReturnFromPromptForCho
ice = PROMPT_DLG_SEL_NONE) Then
iPrompt =
[Link]
t_Last_Prompt_Value
If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY
_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MAT
CH_APPLY_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPL
Y_TO_ALL) Then
g_ReturnFromPromptFor
Choice = iPrompt
End If
End If
'////// end of actual update call
'////// dummy for test
' g_testcount = g_testcount +
1
' If g_testcount = 3 Then
' strReturnMsg = ">>>" &
DynamoInstanceFullyQualifiedName
& " was not updated with " &
MasterDynamoFullyQualifiedName
' iResult =
DYNAMO_NOTUPDATED
' ElseIf g_testcount = 150
Then
' strReturnMsg = ">>> User
canceled"
' iResult =
DYNAMO_UPDATE_ABORTED
' Else
' strReturnMsg =
DynamoInstanceFullyQualifiedName
& " was updated successfully
with " &
MasterDynamoFullyQualifiedName
' iResult = DYNAMO_UPDATED
' End If
'////// end of dummy for test
If iResult <= DYNAMO_UPDATED
Then
UpdateADynamo =
DYNAMO_UPDATED
ElseIf iResult <=
DYNAMO_NOTUPDATED Then
UpdateADynamo =
DYNAMO_NOTUPDATED
Else
UpdateADynamo =
DYNAMO_UPDATE_ABORTED
End If
End Function
Update_A_Dynamo_By_Name2
Method Example
Refer to the Update_A_Dynamo_By_Ref2
Method Example.
Update_A_Dynamo_By_Ref2 allows you to
specify a Dynamo name, while
Update_A_Dynamo_By_Name2 allows you to
specify the Dynamo object’s dispatch pointer.
Update_A_Dynamo_By_Ref Method
Example
The following code provides an example of the
Update_A_Dynamo_By_Ref method that
appears in the modDynamoUpdater module of
the Project_PlugandSolve VBA project.
Public Function
UpdateADynamo2(objDynamoInstance As
Fix2DDynamo.Fix2DDynamo,
objMasterDynamo As
Fix2DDynamo.Fix2DDynamo, ByRef
strReturnMsg) As UpdateDynamoResult
Dim strDIName As String
Dim strDMName As String
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
Dim iUpdateOptions As Long ' update
options
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If g_ReturnFromPromptForChoice
=
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_AL
L Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APP
LY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_A
LL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
' Convert option parameters
iUpdateOptions = &H0
If iDataSourceOption =
DYNAMO_PROMPT_FOR_CHOICE Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_PROMT_FOR_CHO
ICE
ElseIf iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_UPDATE_DYNAMO
+
UPDATE_OPTION_ON_MISMATCH_APPLY_DATA_SO
URCES
ElseIf iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY Then
iUpdateOptions =
UPDATE_OPTION_ON_MISMATCH_UPDATE_DYNAMO
End If
If g_WizardConfig.bKeepSize = True
Then
iUpdateOptions = iUpdateOptions
+ UPDATE_OPTION_RESIZE_INSTANCE
End If
If g_WizardConfig.bKeepCaption =
True Then
iUpdateOptions = iUpdateOptions
+ UPDATE_OPTION_SAVE_CAPTIONS
End If
' Add new option if Dynamo instance
conversion
If g_iDynamoToolType =
DYN_QUICK_CONVERTER Or _
g_iDynamoToolType =
DYN_CONVERTER_WIZARD Then
iUpdateOptions = iUpdateOptions
+ UPDATE_OPTION_UPDATE_ON_CONVERSION
End If
' call Update A Dynamo
[Link]
te_A_Dynamo_By_Ref2 objMasterDynamo,
objDynamoInstance, iUpdateOptions,
[Link](4069), iResult
' get a result string
strReturnMsg =
[Link].Get_Last
_Result_String
' get the last user choice from the
prompt
If
(g_WizardConfig.iDataSourceOption =
DYNAMO_PROMPT_FOR_CHOICE) And _
(g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_NONE) Then
iPrompt =
[Link].Get_Last
_Prompt_Value
If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_AL
L) Or _
(iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APP
LY_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_A
LL) Then
g_ReturnFromPromptForChoice
= iPrompt
End If
End If
'////// end of actual update call
' If iResult <= DYNAMO_UPDATED Then
' UpdateADynamo = DYNAMO_UPDATED
' ElseIf iResult <=
DYNAMO_NOTUPDATED Then
' UpdateADynamo =
DYNAMO_NOTUPDATED
' Else
' UpdateADynamo =
DYNAMO_UPDATE_ABORTED
' End If
If (iResult And
UPDATER_RESULT_SUCCESS_BIT) > 0 Then
UpdateADynamo2 = DYNAMO_UPDATED
End If
If (iResult And
UPDATER_RESULT_DYNAMO_NOT_UPDATED_BIT)
> 0 Then
UpdateADynamo2 =
DYNAMO_NOTUPDATED
End If
If (iResult And
UPDATER_RESULT_USER_CANCELLED_BIT) > 0
_
Or (iResult And
UPDATER_RESULT_SUCCESS_BIT) = 0 Then
UpdateADynamo2 =
DYNAMO_UPDATE_ABORTED
End If
End Function
To view this code in context:
1. In Classic view, from the WorkSpace
menu, select Visual Basic Editor.
-Or-
In Ribbon view, on the Home tab, in
the WorkSpace group, click Visual
Basic Editor.
2. In the tree view, double-click the
Project_PlugandSolve folder, and then
the Modules folder, and finally the
modDynamoUpdater.
3. Search for UpdateADynamo to locate
this code.
Update_A_Dynamo_By_Ref2 Method
Example
The following code provides an example of the
Update_A_Dynamo_By_Ref2 method that
appears in the modDynamoUpdater module of
the Project_PlugandSolve VBA project.
Public Function
UpdateADynamo(objDynamoInstance As
Fix2DDynamo.Fix2DDynamo,
objMasterDynamo As
Fix2DDynamo.Fix2DDynamo, ByRef
strReturnMsg) As UpdateDynamoResult
Dim strDIName As String
Dim strDMName As String
Dim iDataSourceOption As
DynamoDataSourceOption
Dim iResult As Long
'UpdateDynamoResult
Dim iPrompt As Long
iDataSourceOption =
g_WizardConfig.iDataSourceOption
If g_WizardConfig.iDataSourceOption
= DYNAMO_PROMPT_FOR_CHOICE Then
If g_ReturnFromPromptForChoice
=
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_AL
L Then
iDataSourceOption =
DYNAMO_UPDATE_BUT_NOT_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APP
LY_TO_ALL Then
iDataSourceOption =
DYNAMO_UPDATE_AND_APPLY
ElseIf
g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_A
LL Then
iDataSourceOption =
DYNAMO_NOT_UPDATE
End If
End If
'////// actual update call
' call Update A Dynamo
[Link]
te_A_Dynamo_By_Ref2 objMasterDynamo,
objDynamoInstance, iDataSourceOption,
[Link](4069), iResult
' get a result string
strReturnMsg =
[Link].Get_Last
_Result_String
' get the last user choice from the
prompt
If
(g_WizardConfig.iDataSourceOption =
DYNAMO_PROMPT_FOR_CHOICE) And _
(g_ReturnFromPromptForChoice =
PROMPT_DLG_SEL_NONE) Then
iPrompt =
[Link].Get_Last
_Prompt_Value
If (iPrompt =
PROMPT_DLG_SEL_UPDATE_NO_DS_APPLY_TO_AL
L) Or _
(iPrompt =
PROMPT_DLG_SEL_UPDATE_ATTEMPT_MATCH_APP
LY_TO_ALL) Or _
(iPrompt =
PROMPT_DLG_SEL_DO_NOT_UPDATE_APPLY_TO_A
LL) Then
g_ReturnFromPromptForChoice
= iPrompt
End If
End If
'////// end of actual update call
'////// dummy for test
' g_testcount = g_testcount + 1
' strDIName = [Link]
' strDMName = [Link]
' If g_testcount = 3 Then
' strReturnMsg = ">>>" &
strDIName & " was not updated with " &
strDMName
' iResult = DYNAMO_NOTUPDATED
' ElseIf g_testcount = 150 Then
' strReturnMsg = ">>> User
canceled"
' iResult =
DYNAMO_UPDATE_ABORTED
' Else
' strReturnMsg = strDIName & "
was updated successfully with " &
strDMName
' iResult = DYNAMO_UPDATED
' End If
'////// end of dummy for test
If iResult <= DYNAMO_UPDATED Then
UpdateADynamo = DYNAMO_UPDATED
ElseIf iResult <= DYNAMO_NOTUPDATED
Then
UpdateADynamo =
DYNAMO_NOTUPDATED
Else
UpdateADynamo =
DYNAMO_UPDATE_ABORTED
End If
End Function
To view this code in context:
1. In Classic view, from the WorkSpace
menu, select Visual Basic Editor.
-Or-
In Ribbon view, on the Home tab, in
the WorkSpace group, click Visual
Basic Editor.
2. In the tree view, double-click the
Project_PlugandSolve folder, and then
the Modules folder, and finally the
modDynamoUpdater.
3. Search for UpdateADynamo to locate
this code.
UpdateBackgroundObject Method
Example
The following example creates the object
TimerTest in the Schedule TestSchedule and
transfers it to the corresponding schedule
running in the background
FixBackgroundServer application.
Dim TestSchedule As Object
Dim iTimer As Object
Set TestSchedule =
[Link]("TestSchedule")
Set iTimer =
[Link]("FixTime
r")
[Link] = "TimerTest"
[Link] = 1
[Link] = 2000
[Link]
ct "TimerTest", bkAdd, bkRun
UpdateConnectionParameters
Method Example
The following example updates the
UpdateRate to 30.0, Deadband to 5.0 and
Tolerance 15.0 to for the Oval object Oval2.
[Link]
"VerticalFillPercentage", 30.0,
5.0, 15.0
UpdateDefinition Method Example
The following example updates the definitions
contained in a tag group file.
Dim sTokenList(4) as String,
TokenList as Variant
Dim sReplacementList(4) as
String, ReplacementList as
Variant
Dim sDescriptionList(4) as
String, DescriptionList as
Variant
Dim TGD As Object
Set TGD =
CreateObject("TagGroupDefinitionI
[Link]
erface")
[Link] "Test", 4,
TokenList, ReplacementList,
DescriptionList
TokenList(2) = "Tag3"
TokenList(3) = "Tag4"
ReplacementList (2) =
"FIX32.NODE2.AI1.F_CV"
ReplacementList (3) =
"FIX32.NODE2.AI2.F_CV"
DescriptionList (2) =
"Temperature for Node 2"
DescriptionList (3) = "Pressure
for Node 2"
' Create the tag group file
object
Set TGD =
CreateObject("TagGroupDefinitionI
[Link]
erface")
[Link] "Test", 4,
TokenList, ReplacementList,
DescriptionList
Set TGD = Nothing
UserFormPointToLogical Method
Example
The following example converts the Top, Left
coordinates from 30, 50 in "UserForm Point"
coordinates to logical units for the Picture
TestPicture.
Dim dTop As Double
Dim dLeft As Double
dTop = 30
dLeft = 50
[Link]
l dTop, dLeft
V-Z
ValidateSignature Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, validates the signature,
sends a message to the audit trail, and retrieves
the full name of the signer.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bValidSig As Boolean
Dim UserID As String
Dim FullName As String
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
bValidSig = False ' will be set
to TRUE by ValidateSignature if
signature is valid
'Validate the signature
[Link] "admin",
"admin", 1, bValidSig,
Ucase(UserID)
If bValidSig = True Then
'Send a message to the audit
trail
[Link]
"Action Description", "", "",
Ucase(UserID), "Comment"
'Get the full name of the
signer
[Link] Ucase(UserID),
Ucase(FullName)
'Show Results
MsgBox "Action performed by admin
(" + FullName + ") " + "Comment"
Else
MsgBox "Invalid Signature."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
ValidateSignatureAndWriteValue
Method Example
The following example creates the ESignature
object, checks to see if the node is enabled for
electronic signature, and determines if a
specified tag ([Link].D01.F_CV)
requires electronic signature. If required, the
example validates the signature, writes the new
value, and sends a message to the audit trail.
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim nInfo As Integer
Dim NewValue As Variant
'Create the ESignature object
Set ESig =
CreateObject("ElectronicSignature
.ESignatureFactory")
'Check if node is enabled for
electronic signature
[Link]
bNodeSignEnabled
If bNodeSignEnabled = True Then
'Check if tag requires electronic
signature
[Link]
"[Link].DO1.F_CV"
[Link] 0,
bSigRequired, nInfo, bVerify,
bContinuousUse
If bSigRequired = True Then
'Validate the signature, write
the new value and send a message
to the audit trail
NewValue = 1
If bVerify = False Then
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example"
Else
[Link]
ue 0, NewValue, "admin", "admin",
"Perform Comment Example",
"supervisor1", "GEF", "Verify
Comment Example"
End If
Else
MsgBox "Signature is not required
for this tag."
End If
Else
MsgBox "Signature is not enabled
on this node."
End If
ValidateSource Method Example
The following example validates the AI1
source for the Oval Oval1.
Dim iStatus As Long
Dim iObj As Object
Dim sPropName As String
[Link] "AI1",
iStatus, iObj, sPropName
ValueTimeFromXY Method Example
The following example retrieves the value,
date and type which corresponds to the
coordinates 10,25 for the Pen Pen1.
Dim dValue As Double
Dim dDate As Date
Dim bReal As Boolean
[Link] 10, 25,
dValue, dDate, bReal
WritePictureToImageFile Method
Example
The following example creates an image file
named MyPictureImage for an iFIX picture
named MyPicture. The image is not scaled.
The iFIX picture is closed after the image file
is written.
[Link]
le "[Link]",
"MyTestPicImage", True
WriteValue Subroutine Example
The following example writes the value 1 to
the block DO1.
WriteValue 1, "DO1"
Write Method Example
The following example:
• Creates a data system ocx FDS;
• Adds a data Group DataGroup1 to the
Groups collection;
• Adds a DataItem to the DataItems
collection;
• Writes the value of the Group
DataGroup1;
• Writes a value of 45 to the DataItem
'Create the Data System OCX
Dim FDS As Object
Set FDS =
CreateObject("[Link]
llution FD Data System Control")
'Add a group to the Groups
collection
[Link] ("DataGroup1")
[Link]("DataGroup1").Dat
[Link]("[Link].AI1.F_
CV")
'Write DataGroup1
[Link]("DataGroup1").Wri
te
'Write the DataItem
[Link]("DataGroup1").Dat
[Link](1).Write(45)
XYFromValueTime Method Example
The following example retrieves the x and y
coordinates for the value of 10 at the time
11:05 PM for the Pen Pen1.
Dim dX As Double
Dim dY As Double
[Link] 10,
#[Link] PM#, dX, dY
XYHitTest Method Example
The following example retrieves the
information for the pen at the coordinate x,y
for the chart Chart Chart1. Note that the x and
y parameters come from MouseUp and/or
MouseDown event prototypes.
Dim dDate As Date
Dim dValue As Double
Dim sPenName As String
Dim iPen As Object
Dim lPenNum As Long
Dim bReal As Boolean
[Link] x, y, dDate,
dValue, sPenName, iPen, lPenNum,
bReal
Zoom Method Example
The following example zooms in on the Chart
with a high and low vertical value of 50 and 10
and a high and low horizontal value of 75 and
35 for Chart1.
[Link] 50, 10, 75, 35
Index
acknowledge click65, 73, 88, 90, 99, 117
alarms ... 123, 127
close.... 66, 135, 137
activate ............... 58
color............ 67, 160
alarm ................ 106
configure............. 81
AlarmHornEnable
d .................... 129 connections ....... 157
AlarmHornSilenc data ..................... 68
e .................... 266
data source ........ 148
AlarmHornSilenc
e subroutine .. 133 database235, 238, 240
AlarmHornToggle131 deactivate.... 75, 120
digital
alarms60, 61, 63, 123, 127, 129, point135,
131, 177,
140, 143, 266222
alias .................. 189 disable alarms ... 140
automatic mode216, 224 doubleclick ......... 73
block......... 231, 233 dynamo ............. 160
change ................ 68 edit ................ 77, 79
enable alarms ... 143 log in................. 171
manual
event58, 59, 60, 61, 63, 65, 66, mode218,
67, 68, 22479, 80,
73, 75, 77,
false .......... 111, 120 method .............. 293
find ... 148, 150, 168 MouseUpOffObje
ct event.......... 104
FixGetMyname 244
move ................... 95
focus ................... 59
names ................ 189
form .. 160, 161, 164
NlsGetText ....... 248
function231, 233, 235, 238, 240, 242
off scan ............. 173
HDA ................. 248
on scan .............. 175
helper functions244, 248
open .. 177, 179, 184
initialize........ 80, 81
picture137, 153, 179, 184, 20
keydown ............. 82
print .................. 191
keyup .................. 85
ramp .......... 194, 197
limits ................ 145
read values 200, 203
load..................... 89
refresh .............. 110 tge ............. 184, 212
replace ...... 206, 212 toggle ........ 222, 226
report ................ 191 toggle state........ 224
scan .. 173, 175, 226 true............ 115, 121
selection ... 112, 118 unload ................. 89
separator ........... 158 user ................... 167
SeverityIncreased119 variable ............. 108
shell .................. 220 write point ........ 228
WriteValue
subroutine123, 127, 129, 131, 135, 137, 140, 143, 145, 14
Subroutine ..... 228
tag groups89, 184, 212