Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Enumerate Collections

  • Last UpdatedSep 12, 2025
  • 1 minute read

The Process Analyst contains many "collections" such as Panes, Pens, Cursors, Commands, and so on. This example shows you how to enumerate through the buttons on the navigation toolbar.

[VBA]

Sub EnumerateToolbarButtons()
Dim navBar As Object
Dim iButton As Integer
Dim button As Object
Dim nButtons As Integer

` The Navigation toolbar is the 2nd toolbar in the collection
Set navBar = test_CPA.Toolbars.Item(2)
If IsNull(navBar) = False Then
nButtons = navBar.Buttons.Count
For iButton = 1 To nButtons
Set button = navBar.Buttons(iButton)
Next iButton
End If
End Sub

[Cicode]

FUNCTION EnumerateToolbarButtons()
OBJECT hPA = ObjectByName("CPA");
OBJECT hToolbars = _ObjectGetProperty(hPA, "Toolbars");
// The Navigation toolbar is the 2nd toolbar in the collection
OBJECT hNavBar = _ObjectCallMethod(hToolbars, "get_Item", 2);
OBJECT hButtons;
OBJECT hButton;
INT nButtons;
INT iButton;

IF (ObjectIsValid(hNavBar)) THEN
hButtons = _ObjectGetProperty(hNavBar, "Buttons");
nButtons = _ObjectGetProperty(hButtons, "Count");

FOR iButton = 1 TO nButtons DO
hButton = _ObjectCallMethod(hButtons, "get_Item", iButton);
END
END
END

Note: Many collections have an ItemById property that allows you to get the item you want without having to enumerate through the collection to find the item you want.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in