Article View: comp.sys.mac
Article #16097Passing EventRecords to DA's in LSC
From: Jim Meiss
Date: Tue, 12 May 1987 16:37
Date: Tue, 12 May 1987 16:37
38 lines
1900 bytes
1900 bytes
According to IM I-446 when the csCode parameter is set to accEvent,
csParam contains a pointer to the eventRecord . Thus one might expect that one
could use this pointer to call DialogSelect, for example. This does not work,
however, and apparently one needs to do a complicated casting of csParam as
shown in this code fragment from AsciiDA by W. S. Blomgren, who quotes the
DA ZoomIdle by P. Dubois:
-----------------
main (p,d,n)
cntrlParam *p;
DCtlPtr d;
int n;
{
........
switch(n) {
........
case 2: /* action in the DA */
switch(p->csCode) {
case accEvent:
DAevent(((EventRecord *) * (long *) &p->csParam));
/* casting the *address of* p->csParam as an pointer to a long, and the */
/* long is cast as a pointer to a pointer to an eventRecord (I think?) */
/* (from ZoomIdle 1.1 by Paul DuBois) */
/* the pointer is passed as the parameter to DAevent */
------------------
Can someone explain this to me? Wouldn't you think that
(EventRecord *) p->csParam
would be sufficient? My first try was just to pass p->csParam itself, since
its supposed to be the pointer to the eventRecord....but this definitely
doesn't work.
Jim Meiss
jdm@ut-ngp.UTEXAS.EDU
jdm@uta.MFENET.ARPA
Technical Details
Message-ID:
<5186@ut-ngp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!ut-ngp!jdmShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!ut-ngp!jdm From: jdm@ut-ngp.UUCP (Jim Meiss) Newsgroups: comp.sys.mac Subject: Passing EventRecords to DA's in LSC Message-ID: <5186@ut-ngp.UUCP> Date: Tue, 12-May-87 12:37:51 EDT Article-I.D.: ut-ngp.5186 Posted: Tue May 12 12:37:51 1987 Date-Received: Fri, 15-May-87 01:00:07 EDT Organization: UTexas Computation Center, Austin, Texas Lines: 38 Keywords: csParam, LightspeedC, Desk Accessories, Casting