home *** CD-ROM | disk | FTP | other *** search
- 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
- From: keith@taligent.com (Keith Rollin)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Q: Checking for modif keys on app startup
- Message-ID: <Bs55zL.1GD@taligent.com>
- Date: 29 Jul 92 08:23:44 GMT
- References: <1992Jul28.162138.9681@leland.Stanford.EDU> <70554@apple.Apple.COM>
- Sender: usenet@taligent.com (More Bytes Than You Can Read)
- Organization: Taligent
- Lines: 39
-
- In article <70554@apple.Apple.COM>, mlanett@Apple.COM (Mark Lanett) writes:
- >
- > felciano@summit.stanford.edu (Ramon M. Felciano) writes:
- >
- > >I'm writing a 7.0 drag-and-drop application, and would like a "power
- > >user" mode that does some automatic stuff if the user drops files on
- > >the application while holding a particular key down (most likely
- > >command or control). While I know how to check the modifier flags in an
- > >event record, I'm not quite sure how to forcibly read the keyboard. Any
- > >suggestions?
- >
- > pascal void GetKeys(KeyMap theKeys)
- > = 0xA976; File {CIncludes}Events.h Inside Macintosh reference:
- > I-259 Trap number: A976 Moves or purges memory. GetKeys reads the
- > current state of the keyboard (and keypad, if any) and returns it in
- > the form of a keyMap:
- >
- > TYPE KeyMap = PACKED ARRAY[0..127] OF BOOLEAN;
- >
- > Each key on the keyboard or keypad corresponds to an element in the
- > keyMap. The index into the keyMap for a particular key is the same as
- > the key code for that key. (The key codes are shown in Figure 3 above.)
- > The keyMap element is TRUE if the corresponding key is down and FALSE
- > if it isn't. The maximum number of keys that can be down simultaneously
- > is two character keys plus any combination of the four modifier keys.
-
-
- Another way is to call GetOSEvent with the mask set to zero. Then look at the
- modifiers field in the event record.
-
- I don't really know if either method is better than the other. The only thing I
- can think of is that some people (myself included) have a hard time trying to
- figure out how to read the KeyMap variable (I program in C, which defines KeyMap
- as 4 longs, and not a packed array of 128 Booleans).
-
- --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-