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: Interapplication Communication /
Chapter 4 - Responding to Apple Events / Reference to Responding to Apple Events
Data Structures Used by the Apple Event Manager


Apple Event Array Data Types

The AEGetArray function (see page 4-77) creates a Pascal or C array that corresponds to an Apple event array in a descriptor list, and the AEPutArray function (see page 5-32) adds data specified in a buffer to a descriptor list as an Apple event array.

You can use the data type AEArrayType to define the type of Apple event array you want to add to or obtain from a descriptor list.

TYPE AEArrayType = (kAEDataArray, kAEPackedArray, kAEHandleArray,
                    kAEDescArray, kAEKeyDescArray);
When your application adds an Apple event array to a descriptor list, it provides the data for an Apple event array in an array data record, which is defined by the data type AEArrayData.

TYPE AEArrayData = 
   RECORD                        {data for an Apple event array}
      CASE AEArrayType OF
      kAEDataArray:
         (AEDataArray:     ARRAY[0..0] OF Integer);
      kAEPackedArray:
         (AEPackedArray:   PACKED ARRAY[0..0] OF Char);
      kAEHandleArray:
         (AEHandleArray:   ARRAY[0..0] OF Handle);
      kAEDescArray:
         (AEDescArray:     ARRAY[0..0] OF AEDesc);
      kAEKeyDescArray:
         (AEKeyDescArray:  ARRAY[0..0] OF AEKeyDesc);
   END;
The type of array depends on the data for the array:
Array typeDescription of Apple event array
kAEDataArrayArray items consist of data of the same size and same type, and are aligned on word boundaries.
kAEPackedArrayArray items consist of data of the same size and same type, and are packed without regard for word boundaries.
kAEHandleArrayArray items consist of handles to data of variable size and the same type.
kAEDescArrayArray items consist of descriptor records of different descriptor types with data of variable size.
kAEKeyDescArrayArray items consist of keyword-specified descriptor records with different keywords, different descriptor types, and data of variable size.

Array items in Apple event arrays of type kAEDataArray, kAEPackedArray, or kAEHandleArray must be factored--that is, contained in a factored descriptor list. Before adding array items to a factored descriptor list, you should provide both a pointer to the data that is common to all array items and the size of that common data when you first call AECreateList to create a factored descriptor list. When you call AEPutArray to add the array data to such a descriptor list, the Apple Event Manager automatically isolates the common data you specified in the call to AECreateList.

When you call AEGetArray or AEPutArray, you specify a pointer of data type AEArrayDataPointer that points to a buffer containing the data for the array.

TYPE AEArrayDataPointer = ^AEArrayData; 
For more information about using AECreateList to create factored descriptor lists for arrays, see page 5-29. For information about using AEGetArray and AEPutArray, see page 4-77 and page 5-32, respectively.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996