home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 12991 < prev    next >
Encoding:
Text File  |  1992-07-24  |  2.4 KB  |  55 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!stanford.edu!ames!pacbell.com!well!smoke
  3. From: smoke@well.sf.ca.us (Nicholas Jackiw)
  4. Subject: Re: Using PostHighLevelEvents to send low level (KeyPressed) events
  5. Message-ID: <BrwHyy.18n@well.sf.ca.us>
  6. Sender: news@well.sf.ca.us
  7. Organization: Whole Earth 'Lectronic Link
  8. References: <76508@ut-emx.uucp>
  9. Distribution: na
  10. Date: Fri, 24 Jul 1992 16:04:10 GMT
  11. Lines: 42
  12.  
  13. In article <76508@ut-emx.uucp> mmigdol@ccwf.cc.utexas.edu (michael a migdol) writes:
  14. >According to IM VI, p. 5-18, "Your application can both send and receive high-
  15. >level events, but it generally only receives low-level events and should not
  16. >send them."
  17. >
  18. >So, this implies that I *can* send KeyPressed events to other applications. 
  19. >(Even though I "shouldn't", I want to. I really do! :) )
  20.  
  21. That's right; you can and "shouldn't."  Remember, however, that it's *your*
  22. Macintosh and you can do what you damn well like with it.
  23.  
  24. >
  25. >Anyways, Apple certainly doesn't seem to encourage this, and I'm about to try
  26. >this out myself, but am I supposed to use PostHighLevelEvents with theEvent.what
  27. >set to Keypressed (or whatever) to do this? Am I going to hit any problems 
  28. >later on? Does the application I'm sending to have to "AcceptHighLevelEvents"
  29. >to receive low level events sent this way?
  30.  
  31. No, PostHighLevelEvents won't work for this; all high-level events are of
  32. the same low-level event type.  Nor do you need AcceptHighLevelEvents; this
  33. will simply add unnecessary launch-time overhead.
  34.  
  35. I believe that any low-level event gets sent to the event handler of the
  36. foremost application.  This means you'll need to have your receiver in
  37. front.  (See the Process Manager in System 7 for how to do this automatically,
  38. otherwise just bring it to the front with the multifinder menu after 
  39. launching the sender.)  Then, call PostEvent from your sender with
  40. the appropriate keydowns.  
  41.  
  42. [Actually, I think you should use PPostEvent, which will return to you
  43. a pointer to the event that will be shipped the frontapp. You want this
  44. pointer if you intend to do any preprocessing of the event record, such
  45. as clearing its modifier keys or setting the "where" field to a mouse
  46. location of your choice.]
  47.  
  48.  
  49.  
  50. -- 
  51.                               --- * ---
  52. Nick Jackiw                  Smoke@well.sf.ca.us   | Jackiw@cs.swarthmore.edu
  53. Key Curriculum Press, Inc.   Applelink:KEY.EDUSOFT | (510) 548-2304
  54.                               --- * ---
  55.