Re: Keyboard Event
Re: Keyboard Event
- Subject: Re: Keyboard Event
- From: Esteban <email@hidden>
- Date: Wed, 27 Feb 2002 18:00:15 -0800
Marcos,
One way to do this is to subclass the view. You can roll your own
version of the NSView's -(void)keyDown and then from the NSEvent
returned you can test for which keys were pressed using the keyMasks
defined in
file:///System/Library/Frameworks/AppKit.framework/Versions/C/Resources/English.
lproj/Documentation/Reference/ObjC_classic/TypesAndConstants/AppKitTypes.html
You can use NSEventMaskFromType([theEvent type]) method to get the event
mask so you can test against the keyMasks. :)
Also if the particular view you have has other keyDown functionalities,
then you can just call [super keyDown:theEvent]; at the end of you
subclasses keyDown method, so that the rest of the view's functionality
remains intact.
-Esteban
On Wednesday, February 27, 2002, at 07:11 PM, Marcos Tirao wrote:
Hi! I was reading the Documentation About COCOA but I couldn't figure
out how to implement a keyboard Event. I mean, I Have a view and I need
to have that when the user press certain key respond i a different way
for each key pressed.
Can anyone help me?
_______________________________________________
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.
_______________________________________________
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.