Re: Shift Key
Re: Shift Key
- Subject: Re: Shift Key
- From: Bill Cheeseman <email@hidden>
- Date: Sun, 06 Jul 2003 07:32:22 -0400
on 03-07-05 11:21 PM, Matt Gemmell at email@hidden wrote:
>
On 6/7/03 at 3:38 am, Aaron Boothello said:
>
>
> In a Cocoa Application, how do i check if a Shift-key is down/up, and
>
> how do i detect if the user has pressed the "delete" key? Right now i
>
> have to press The 'fn'+delete key on my PowerBook.
>
>
Take a look at the documentation for NSEvent and NSResponder. In
>
particular, look at NSResponder's keyDown: and keyUp: methods, and take
>
a look at the -modifierFlags method of NSEvent. You'll check the
>
modifierFlags of an event to see if the shift key is pressed.
>
>
NSApplication and NSWindow also both have a -currentEvent method which
>
will probably be of interest. :)
Many of the function keys on newer PowerBooks are set at the factory to be
hardware control keys (sound volume, screen brightness, etc.). To give them
their more traditional function key behavior, you have to hold down the fn
key. No amount of Cocoa code will change this, as far as I know.
I have heard that you can boot into Mac OS 9 and use the appropriate Control
Panel to reverse this arrangement (unless you have a PowerBook that won't
boot into 9), and that doing so will set a flag in PRAM that will continue
to work when you boot back into Mac OS X. It didn't work for me the one time
I tried it, but I could have done something wrong.
In my opinion, the hardware control behavior is the behavior that ought to
require the fn key, so that we can use the function keys as one-finger
function keys. But I imagine Apple has statistics to prove that the majority
of users never uses the function keys for anything except hardware control.
At the very least, the Mac OS 9 Control Panel trick ought to be written into
Mac OS X System Preferences, now that some machines can't boot into 9.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.