Chapter 4 ActiveX Client Interfaces
Type Library Name |
JaguarTypeLibrary |
DLL Name |
jagproxy.dll |
Represents a collection of objects or primitive data values; the ActiveX mapping for CORBA IDL sequences used as method parameter or return types in Jaguar methods.
Count as Integer
The number of available items.
Item(index as Integer) as Object
Set or retrieve an item's value. The first item has index 0. All VARIANT values are allowed, except for arrays. When setting item values, index can be any positive integer starting with 0, and the value can be any type supported by the ActiveX client proxy and ActiveX component dispatcher. See the Jaguar CTS Programmer's Guide for a list of supported types.
JCollection represents an IDL sequence. Any return value or parameter that is defined as an IDL sequence in a Jaguar IDL interface is represented as a JCollection in the equivalent ActiveX proxy interface. The JCollection contains the ActiveX equivalent for the base type of the IDL sequence. Nested IDL sequences map to nested JCollection instances.
You can iterate over the items in a JCollection instance using a For ... To loop or a For Each ... In loop. The following example shows a For ... To loop:
Dim stringJColl as JaguarTypeLibrary.JCollection
Set stringJColl = myComp.methodThatReturnsSequenceOfString()
Dim stringItem as String
Dim iter as Integer
For iter = 1 To stringJColl.Count
stringItem = Format(stringJColl.Item(iter - 1))
Next iter
The following example shows a For Each ... In loop that iterates through all items in the collection myJColl:
Dim myJColl as JaguarTypeLibrary.JCollection
Set myJColl = myComp.methodThatReturnsSequenceOfString()
Dim myObject as Object
For Each myObject in myJColl
Dim strItem as String
strItem = format(MyObject)
Next
The following example shows how to iterate over items in a nested collection. In the example, outerC is a JCollection instance that contains JCollection instances as items:
Dim outerC as JaguarTypeLibrary.JCollection
set outerC = myComp.methodThatReturnsNestedSequence()
Dim innerC as JaguarTypeLibrary.JCollection
Dim strItem as String
Dim i as Integer
Dim j as Integer
For i=1 to outerC.Count
innerC = outerC.Item(i - 1)
For j=1 to innerC.Count
strItem = Format(innerC.Item(j - 1))
Next j
Next i
In a collection innerC nested inside another collection outerC, the j'th item in the i'th nested collection can be accessed directly as follows:
Dim outerC as JaguarTypeLibrary.JCollection
set outerC = myComp.methodThatReturnsNestedSequence()
Dim innerC as JaguarTypeLibrary.JCollection
Dim myObject as Object
i as Integer
Dim j as Integer
myObject = outerC.Item(i).Item(j)
Jaguar CTS Programmer's Guide
Copyright © 2000 Sybase, Inc. All rights reserved. |
![]() |