Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 5 - Collection Manager / Using the Collection Manager


Determining the Tag and ID of an Item

Just as you can determine the collection index of an item given its collection tag and ID, you can also determine the collection tag and ID of an item given its collection index. Listing 5-6 shows how to determine an item's collection tag and collection ID using the GetIndexedCollectionItemInfo function.

Listing 5-6 Determining the tag and ID of an item given the item's index

long tag, id;
.
.
.
anErr = GetIndexedCollectionItemInfo(pointsAndQuotes, 
                                     index, /* index of item */
                                     &tag,  /* returned tag */
                                     &id,   /* returned id */
                                     dontWantSize,   
                                     dontWantAttributes);  
You need to set the value of the index variable to contain the collection index of the desired item before making this call to the GetIndexedCollectionItemInfo function. (See the previous section, "Determining the Collection Index of an Item" on page 5-19, for in the GetCollectionItemInfo function shown in Listing 5-6, the tag variable contains the collection tag and the id variable contains the collection ID of the item in the pointsAndQuotes collection with the collection index specified by the index variable.

If you know the collection tag of an item and you know its tag list position, you can use the GetTaggedCollectionItemInfo function to determine its collection ID. For example, you could also use the call

anErr = GetTaggedCollectionItemInfo(pointsAndQuotes, 
                                    'GXPT', 11,
                                    &id, 
                                    dontWantIndex, 
                                    dontWantSize, 
                                    dontWantAttributes);
to determine the collection ID of the eleventh item in the pointsAndQuotes collection with the tag 'GXPT'. With the pointsAndQuotes collection defined in "Adding Items to a Collection" beginning on page 5-17, the collection ID of this item turns out to be 15.

For more information about identifying collection items, see "Methods of Identifying Collection Items" on page 5-11.

For more information about the GetCollectionItemInfo and GetTaggedCollectionItemInfo functions, see "Getting Information About a Collection Item" beginning on page 5-76.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996