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