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 6 - Resolving and Creating Object Specifier Records / Reference to Resolving and Creating Object Specifier Records
Application-Defined Routines / Object Callback Functions


MyCountObjects

If you want the Apple Event Manager to help your application resolve object specifier records of key form formTest (and if your application doesn't specify kAEIDoWhose as described on page 6-56), you should provide an object-counting function and an object-comparison function. An object-counting function counts the number of Apple event objects of a specified class in a specified container.

FUNCTION MyCountObjects (desiredClass: DescType; 
                         containerClass: DescType; 
                         theContainer: AEDesc; 
                         VAR result: LongInt): OSErr;
desiredClass
The object class of the Apple event objects to be counted.
containerClass
The object class of the container for the Apple event objects to be counted.
theContainer
A token that identifies the container for the Apple event objects to be counted.
result
Your object-counting function should return in this parameter the number of Apple objects of the specified class in the specified container.
DESCRIPTION
The Apple Event Manager calls your object-counting function when, in the course of resolving an object specifier record, the manager requires a count of the number of Apple event objects of a given class in a given container.

SPECIAL CONSIDERATIONS
If the Apple Event Manager receives the result code errAEEventNotHandled after calling an object-counting function, it attempts to use other methods of counting the specified objects, such as calling an equivalent system object-counting function. Thus, an object-counting function that can't count the specified objects should return errAEEventNotHandled. This allows the Apple Event Manager to try other object-counting functions that may be available.

RESULT CODES
noErr0No error occurred
errAEEventNotHandled-1708The object-counting function is unable to count the specified Apple event objects
SEE ALSO
For more information, see "Writing an Object-Counting Function" on page 6-56.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996