home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / programm / 13141 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.2 KB

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!ames!eos!data.nas.nasa.gov!taligent!keith@taligent.com
  2. From: keith@taligent.com (Keith Rollin)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Q: Checking for modif keys on app startup
  5. Message-ID: <Bs55zL.1GD@taligent.com>
  6. Date: 29 Jul 92 08:23:44 GMT
  7. References: <1992Jul28.162138.9681@leland.Stanford.EDU> <70554@apple.Apple.COM>
  8. Sender: usenet@taligent.com (More Bytes Than You Can Read)
  9. Organization: Taligent
  10. Lines: 39
  11.  
  12. In article <70554@apple.Apple.COM>, mlanett@Apple.COM (Mark Lanett) writes:
  13. > felciano@summit.stanford.edu (Ramon M. Felciano) writes:
  14. > >I'm writing a 7.0 drag-and-drop application, and would like a "power
  15. > >user" mode that does some automatic stuff if the user drops files on
  16. > >the application while holding a particular key down (most likely
  17. > >command or control). While I know how to check the modifier flags in an
  18. > >event record, I'm not quite sure how to forcibly read the keyboard. Any
  19. > >suggestions?
  20. > pascal void GetKeys(KeyMap theKeys)
  21. >         = 0xA976; File {CIncludes}Events.h Inside Macintosh reference:
  22. > I-259 Trap number: A976 Moves or purges memory.  GetKeys reads the
  23. > current state of the keyboard (and keypad, if any) and returns it in
  24. > the form of a keyMap:
  25. > TYPE KeyMap = PACKED ARRAY[0..127] OF BOOLEAN;
  26. > Each key on the keyboard or keypad corresponds to an element in the
  27. > keyMap. The index into the keyMap for a particular key is the same as
  28. > the key code for that key. (The key codes are shown in Figure 3 above.)
  29. > The keyMap element is TRUE if the corresponding key is down and FALSE
  30. > if it isn't. The maximum number of keys that can be down simultaneously
  31. > is two character keys plus any combination of the four modifier keys.
  32.  
  33.  
  34. Another way is to call GetOSEvent with the mask set to zero. Then look at the
  35. modifiers field in the event record.
  36.  
  37. I don't really know if either method is better than the other. The only thing I
  38. can think of is that some people (myself included) have a hard time trying to
  39. figure out how to read the KeyMap variable (I program in C, which defines KeyMap
  40. as 4 longs, and not a packed array of 128 Booleans).
  41.  
  42. --
  43. Keith Rollin
  44. Phantom Programmer
  45. Taligent, Inc.
  46.