Important: The information in this document is obsolete and should not be used for new development.
Changing the Default Attributes of a Collection
Every collection object has default attributes. When you add a new item to a collection, the Collection Manager sets the attributes of the new item to match the default attributes of the collection. You can change the attributes of individual items in a collection using the functions described in "Getting and Setting the Attributes of an Item" beginning on page 5-24. You can change the default attributes for a collection using theSetCollectionDefaultAttributes
function. This function allows you to change the value of a collection's default attributes. With this function, you can change the value of every default attribute or you can choose to change only some of the default attributes.This function takes three parameters:
(See Figure 5-3 on page 5-10 for an overview of editing attributes.)
- a reference to the collection object
- a mask specifying which attributes you want to edit
- the new values for the attributes
As an example, Listing 5-2 changes the default attributes for a collection object so that
Listing 5-2 Changing the default attributes of a collection
- user attribute 0 and the lock attribute are set
- all other attributes are clear
long newAttributes; . . . newAttributes = collectionUser0Mask /* set user 0 bit */ | collectionLockMask; /* set lock bit */ anErr = SetCollectionDefaultAttributes(anyCollection, allCollectionAttributes, /* mask */ newAttributes); /* new values */In this example, theallCollectionAttributes
mask, which is defined in "Attributes Masks" on page 5-49, specifies that you want to replace the value of every attribute in the collection's default attributes with the corresponding value in thenewAttributes
parameter. The value of thenewAttributes
parameter specifies that the user 0 attribute and the lock attribute are set while every other attribute is clear.You can use different values for the second parameter of this function if you want to edit some of the collection's default attributes but leave other default attributes unchanged. For example, you could set the second parameter of this function to the
userCollectionAttributes
mask:
anErr = SetCollectionDefaultAttributes(anyCollection, userCollectionAttributes, /* mask */ newAttributes); /* new values */Using this mask specifies that you want to edit only the user attributes of the collection's default attributes. The function replaces the existing values for the collection's default user attributes with the values of the user attributes from thenewAttributes
parameter. In this example, the user 0 attribute is set while all the other user attributes are cleared. However, this call to theSetCollectionDefaultAttributes
function does not change the values of any of the reserved attributes. For example, the value of the lock attribute in the collection's default attributes remains the same as it was--the value of the lock attribute in thenewAttributes
parameter makes no difference as it is not copied into the collection's default attributes.You can find more information about the
SetCollectionDefaultAttributes
function on page 5-61.If you want to examine the default attributes of a particular collection object, you can use the
GetCollectionDefaultAttributes
function, which is described on page 5-60.