[comp.sys.mac.programmer] 3

gft_robert@gsbacd.uchicago.edu (opcode ranger) (02/07/91)

-- 
I have 3 basic System 7 questions:

1) How do you tell if you've actually been passed a default reply to your AE
handler?  (The docs seem to say that it's an optional thing that the client can
request or not). Check reply.dataHandle to see if it's not nil?

2) If you want to handle all core AE's in order to "System 7 friendly", but
your app doesn't print, should you just return noErr from your 'Print Docs' AE
handler?

3) I'm a bit confused about how all AEDesc's are substitutable for one another.
If the typedef for the basic AEDesc is of this form:

	DescType descriptorType;
	Handle dataHandle;
	
and an AppleEvent == AERecord == AEDescList == AEDesc, does this mean that an
AppleEvent -- in addition to containing the keyword descriptors for attributes
and parameters -- also has a descriptorType and dataHandle itself? (obviously I
have no idea what I'm talking about, so feel free to straighten me out :->;
I've read the relevant section of IM VI numerous times, but I  guess I'm just
missing the new paradigm and trying to make the AE's not abstract enough).

Any help much appreciated!


Robert

============================================================================
= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
=            		         * all my opinions are *  compute"         =
=                                * mine                *  -Kraftwerk       =
============================================================================

lai@Apple.COM (Ed Lai) (02/08/91)

In article <1991Feb6.185413.1@gsbacd.uchicago.edu> gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
>-- 
>I have 3 basic System 7 questions:
>
>1) How do you tell if you've actually been passed a default reply to your AE
>handler?  (The docs seem to say that it's an optional thing that the client can
>request or not). Check reply.dataHandle to see if it's not nil?
>

Yes, check to see if reply.dataHandle = nil.

>2) If you want to handle all core AE's in order to "System 7 friendly", but
>your app doesn't print, should you just return noErr from your 'Print Docs' AE
>handler?
>

The easiest way is not to provide a 'pdoc' handler at all. If the client had
asked for a reply, he would automatically get a eventNotHandled error as a
'errn' parameter in the reply.

>3) I'm a bit confused about how all AEDesc's are substitutable for one another.
>If the typedef for the basic AEDesc is of this form:
>
>	DescType descriptorType;
>	Handle dataHandle;
>	
>and an AppleEvent == AERecord == AEDescList == AEDesc, does this mean that an
>AppleEvent -- in addition to containing the keyword descriptors for attributes
>and parameters -- also has a descriptorType and dataHandle itself? (obviously I
>have no idea what I'm talking about, so feel free to straighten me out :->;
>I've read the relevant section of IM VI numerous times, but I  guess I'm just
>missing the new paradigm and trying to make the AE's not abstract enough).
>

Think of it in an object oriented way. AEDesc is the basic object. 
AEDescList is a list of AEDesc, it is a subclass of AEDesc.
AERecord is an AEDescList where each element has a keyword, it is a subclass
of AEDescList.
AppleEvent is a special kind of AERecord used for communication between
processes, it is a subclass of AERecord.
So AEDisposeDesc has an AEDesc as the parameter, but you can use it also for
AEDescList/AERecord/AppleEvent.
So AECountItems count the number of items in an AEDescList, but you can
also use it to count the number of parameters in AERecord/AppleEvent.


>Any help much appreciated!
>
>
>Robert
>
>============================================================================
>= gft_robert@gsbacd.uchicago.edu * generic disclaimer: * "It's more fun to =
>=            		         * all my opinions are *  compute"         =
>=                                * mine                *  -Kraftwerk       =
>============================================================================

/* Disclaimer: All statments and opinions expressed are my own */
/* Edmund K. Lai                                               */
/* Apple Computer, MS37-UP                                     */
/* 20525 Mariani Ave,                                          */
/* Cupertino, CA 95014                                         */
/* (408)974-6272                                               */
zW@h9cOi