Carbon


OSLGetMarkTokenProcPtr

Header: AEObjects.h Carbon status: Supported

Defines a pointer to a mark token callback function. Your mark token function returns a mark token.

typedef OSErr(* OSLGetMarkTokenProcPtr) (
    const AEDesc *dContainerToken, 
    DescType containerClass, 
    AEDesc *result
);

You would declare your function like this if you were to name it MyOSLGetMarkTokenCallback:

OSErr MyOSLGetMarkTokenCallback (
    const AEDesc *dContainerToken, 
    DescType containerClass, 
    AEDesc *result
);
Parameter descriptions
dContainerToken

A pointer to the Apple event object that contains the elements to be marked with the mark token. (Token is defined in AEDisposeToken.)

containerClass

The object class of the container that contains the objects to be marked.

result

A pointer to a descriptor record where your mark token function should return a mark token. If your function can’t return a mark token, it should return a null descriptor.

function result

A result code. Your mark token function should return noErr if it successfully supplies a mark token and errAEEventNotHandled if it fails to supply a mark token. When the Apple Event Manager gets an error result of errAEEventNotHandled after calling a mark token function, it attempts to get a mark token by calling the equivalent system marking callback function.

DISCUSSION

To get a mark token, the Apple Event Manager calls your mark token function. Like other tokens, the mark token returned can be a descriptor record of any type; however, unlike other tokens, a mark token identifies the way your application will mark Apple event objects during the current session while resolving a single object specifier record that specifies the key form formTest.

A mark token is valid until the Apple Event Manager either disposes of it by calling AEDisposeToken or returns it as the result of the AEResolve function. If the final result of a call to AEResolve is a mark token, the Apple event objects currently marked for that mark token are those specified by the object specifier record passed to AEResolve, and your application can proceed to do whatever the Apple event has requested. Note that your application is responsible for disposing of a final mark token with a call to AEDisposeToken, just as for any other final token.

If your application supports marking, it should also provide a token disposal function modeled after the token disposal function described in OSLDisposeTokenProcPtr. When the Apple Event Manager calls AEDisposeToken to dispose of a mark token that is not the final result of a call to AEResolve, the subsequent call to your token disposal function lets you know that you can unmark the Apple event objects marked with that mark token. A call to AEDisposeDesc to dispose of a mark token (which would occur if you did not provide a token disposal function) would go unnoticed.

To provide a pointer to your mark token callback function, you create a universal procedure pointer (UPP) of type OSLGetMarkTokenUPP, using the function NewOSLGetMarkTokenUPP. You can do so with code like the following:

OSLGetMarkTokenUPP MyGetMarkTokenUPP;

MyGetMarkTokenUPP = NewOSLGetMarkTokenUPP (&MyGetMarkTokenCallback);

You can then pass the UPP MyGetMarkTokenUPP as a parameter to the AESetObjectCallbacks function or the AEInstallSpecialHandler function.

If you wish to call your mark token callback function directly, you can use the InvokeOSLGetMarkTokenUPP function.

After you are finished with your mark token callback function, you can dispose of the UPP with the DisposeOSLGetMarkTokenUPP function. However, if you will use the same mark token function in subsequent calls to the function AESetObjectCallbacks or the function AEInstallSpecialHandler, you can reuse the same UPP, rather than dispose of it and later create a new UPP.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)