home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20572 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  2.0 KB

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