Count Property Example

This example first counts and displays the names of the open sessions. It then counts and displays the names of the QuickPads visible for the active session.

Sub Main()

 Dim Sys As Object, Sess As Object, QPad As Object

 

 Set Sys = CreateObject("EXTRA.System")

'Assumes at least one open session

 

 ' This tests the Count property for a Sessions object.

 NumberOfSessions = Sys.Sessions.Count

 For i = 1 to NumberOfSessions

  OpenSessions$ = OpenSessions$ + Sys.Sessions.Item(i).Name + " "

 Next

 

 MsgBox "The following sessions are open: " + OpenSessions$

 

 ' This tests the Count property for a QuickPads object. This
 ' example works equally well for toolbars, replacing the
 ' QuickPads collection object with a Toolbars collection object.

 Set Sess = Sys.ActiveSession

 

 NumberOfQPads = Sess.QuickPads.Count

 For i = 1 to NumberOfQPads

  If Sess.QuickPads.Item(i).Visible Then

  VisiblePads$ = VisiblePads$ + Sess.QuickPads.Item(i).Name + " "

  End If

 Next

 

 MsgBox "The following QuickPads are visible: " + VisiblePads$

End Sub