[comp.sys.mac] PPostEvent

mnkonar@pavo.SRC.Honeywell.COM (Murat N. Konar) (12/10/88)

A couple of days I ago I posted a request foor info on the proper 
use of PPostEvent.

I figured it out myself last night with help from the LightsBug debugger
in LSP 2.0.  What a grovin' product.  And I like the automatic
pretty printing, always have, always will.  But I digress.  

The qEl that PPostEvent returns to you in its var parameter is not really 
the event record that corresponds to the event you just posted.  Rather it 
seems to be the event ahead of the one you really want.  You can get to the
event record you want by defreferencing the qLink field of the event record
returned by PPostEvent.  

A code fragment is worth a thousand words.
__________________________________________
PROCEDURE PostMyEvent( h,v :integer);
   VAR
     theErr: osErr;
     qEl: evQEl;
     {This procedure posts a mouseDown event at the given coords}
   BEGIN
      theErr := PPostEvent(mouseDown, 0, qEl);
      qEl.qLink^.evQElem.evtQWhere.h := h;
      qEl.qLink^.evQElem.evtQWhere.v := v;
   END;{PostMyEvent}
		     
Hope this does someone some good.
______________________________________________________________________
Have a day. :^|
Murat N. Konar
mnkonar@pavo.UUCP
Honeywell Systems & Research
Center, Camden, MN

brecher@well.UUCP (Steve Brecher) (12/11/88)

In article <13204@srcsip.UUCP>, mnkonar@pavo.SRC.Honeywell.COM (Murat N. Konar)
writes:

> The qEl that PPostEvent returns to you in its var parameter is not really
> the event record that corresponds to the event you just posted.

Right.  You were mislead by an error in Inside Macintosh.  The correct type
of the last argument to PPostEvent is evQElPtr.
-- 

--
brecher@well.UUCP (Steve Brecher)