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


MyCompareObjects

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. After comparing one Apple event object to another or to the data for a descriptor record, an object-comparison function should return TRUE or FALSE in the result parameter.

FUNCTION MyCompareObjects (comparisonOperator: DescType; 
                           object: AEDesc; 
                           objectOrDescToCompare: AEDesc; 
                           VAR result: Boolean): OSErr;
comparisonOperator
The comparison operator. See the description of CreateCompDescriptor on page 6-102 for standard comparison operators at the time of publication of this book. The current version of the Apple Event Registry: Standard Suites lists all the constants for comparison operators.
object
A token.
objectOrDescToCompare
A token or some other descriptor record that specifies either an Apple event object or a value to compare to the Apple event object specified by the object parameter.
result
Your object-comparison function should return, in this parameter, a Boolean value that indicates whether the values of the object and objectOrDescToCompare parameters have the relationship specified by the comparisonOperator parameter (TRUE) or not (FALSE).
DESCRIPTION
The Apple Event Manager calls your object-comparison function when, in the course of resolving an object specifier record, the manager needs to compare an Apple event object with another or with a value.

It is up to your application to interpret the comparison operators it receives. The meaning of comparison operators differs according to the Apple event objects being compared, and not all comparison operators apply to all object classes.

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

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


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996