Skip navigation.
 
mlRe: select Button
FROM : Andrew
DATE : Wed Jan 01 00:48:48 2003

On Tue, 31 Dec 2002, John Q. wrote:

> I would like to jump from button to button with the courser keys!!
> And if i press enter the funktion get called!!


If you need to intercept key presses the way I ended up having to do it
was to use a custom subclass of NSWindow and override sendEvent.

- (void)sendEvent:(NSEvent *)anEvent {

   if (([anEvent type] == NSKeyDown) &&
       ([[self delegate]
respondsToSelector:@selector(keyDownInWindow:)]) &&
       ([[self delegate] keyDownInWindow:anEvent] == TRUE)) {
           return;
   }

   [super sendEvent:anEvent];
}

Obviously you could check to see if it was a cursor key and only send
those to your delegate or do that check in keyDownInWindow.

I got the basis of this code from someone else's very helpful posting to
this list although their name temporarily escapes me.

Andrew
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlselect Button John Q. Dec 31, 17:25
mlRe: select Button Jean-Olivier Lanct… Dec 31, 18:47
mlRe: select Button David Remahl Dec 31, 19:13
mlRe: select Button Andrew Jan 1, 00:48
mlRe: select Button John Q. Jan 1, 17:42
mlRe: select Button John Q. Jan 1, 23:21
mlRe: select Button David Rio Vierra Jan 2, 06:38