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