home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18686 < prev    next >
Encoding:
Internet Message Format  |  1992-11-19  |  1.9 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!apple!apple!evans
  2. From: evans@Apple.COM (John Evans)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Determining modifier key status without an event record
  5. Message-ID: <74508@apple.apple.COM>
  6. Date: 20 Nov 92 02:17:53 GMT
  7. References: <Bxy4IM.25J@news.udel.edu>
  8. Organization: Apple Computer Inc., Cupertino, CA
  9. Lines: 28
  10.  
  11. There are several ways I know of to find out which keys are currently
  12. pressed, depending on whether you want to know everything, or just
  13. which modifier keys are pressed.  Here the the way I've seen used
  14. most often for getting the state of the modifiers.
  15.  
  16.      OSEventAvail(0, &event)
  17.  
  18. This will take the event record you pass in, and fill it with a null
  19. event.  The modifiers field of the event record will contain accurate
  20. information.
  21.  
  22. If you're making option-menu-commands (or shift-menu-commands) you might
  23. want to consider using the modifiers from the mouse-down event.  This would
  24. allow you to change the menu item strings depending on the modifiers at
  25. mousedown time.  For instance, if the use holds the option key down and
  26. clicks in the menubar, you could change "Foo" to "Foo with options" so
  27. the user knows what's about to happen.  This (of course) wouldn't allow
  28. the user to change this dynamically while looking at the menu item (and
  29. pressing/releasing the option key) but would allow some brute-force menu
  30. item changing.
  31.  
  32. -- 
  33. +========================+===============================================+
  34. | John S. Evans          | These opinions are mine. Apple's opinions are |
  35. | Collaborative Systems  | Apple's.  Any similarity is coincidental.     |
  36. | Apple Computer, Inc    | "They've given you a number, and taken away   |
  37. | evans@apple.com        |  your name."                  -Johnny Rivers  | 
  38. +========================+===============================================+
  39.