home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!apple!goofy!mumbo.apple.com!gallant.apple.com!seuss.apple.com!user
- From: absurd@apple.apple.com (Tim Dierks, software saboteur)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Distinguishing FrontClicks?
- Message-ID: <absurd-030193142840@seuss.apple.com>
- Date: 3 Jan 93 22:40:14 GMT
- References: <BzpzH1.8tD@unx.sas.com>
- Sender: news@gallant.apple.com
- Followup-To: comp.sys.mac.programmer
- Organization: MacDTS Marauders
- Lines: 34
-
- In article <BzpzH1.8tD@unx.sas.com>, Michael Hecht
- <Michael_Hecht@mac.sas.com> wrote:
- >
- > Hello!
- >
- > I turned on the getFrontClicks bit in my SIZE resource, because it makes
- > sense for my application. However, I don't want *all* parts of the window
- > to respond to layer-changing clicks. How can I distinguish a click that
- > changes my layer from other clicks?
-
- A technique that's worked for me is to compare the 'when' fields of the
- click and the resume event; if the mouseDown has a time before the
- resume event, then it's probably this click that caused you to be switched.
- (The exception would be if the user had posted several events, which got
- queued up because [Get|Wait]NextEvent wasn't being called often enough;
- for example, if I have an INIT which switches layers when I hit a hot key
- installed, and I type the hot key, then click, the click won't have caused
- the switch, but it will seem like it had.)
-
- Specifically, when you get a resume, remember the value in the "when"
- field;
- when you get the first mouseDown after the resume, check its when; if it
- was posted before the resume (or at the same time), consider it to be the
- click that brought you forward.
-
- Official sounding warning: this is only a side effect of the way the
- process manager works now. Don't count on it continuing to work this way,
- it's not a documented feature. If you want to use it, make sure you're
- willing to accept the ways in which it might break (unreliable detection
- of clicks which bring the layer to the front).
-
- Enjoy,
- Tim Dierks
- MacDTS, but I speak for myself and my Albert Einstein doll
-