• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Capturing keydown events in an NSImageView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Capturing keydown events in an NSImageView?


  • Subject: Capturing keydown events in an NSImageView?
  • From: Jerry LeVan <email@hidden>
  • Date: Fri, 25 Jun 2004 11:55:10 -0400

Hello,

I am trying to capture keydown events for an ImageView.

I have subclassed NSImageView ....
--------
#import <Cocoa/Cocoa.h>

@interface KeyImageView : NSImageView
{
IBOutlet id theController; // provides access to main controller object
}

-(BOOL)acceptsFirstResponder;
-(BOOL)resignFirstResponder;
-(BOOL)becomeFirstResponder;
-(void)keyDown:(NSEvent*)theEvent;

@end

-------------
#import "KeyImageView.h"

@implementation KeyImageView
-(BOOL)acceptsFirstResponder
{
NSLog(@"Accepting First Responder");
return YES;
}

-(BOOL)resignFirstResponder
{
NSLog(@"Resigned First Responder");
return YES;
}

-(BOOL)becomeFirstResponder
{
NSLog(@"Become First Responder");
}

-(void)keyDown:(NSEvent*)theEvent
{
NSLog(@"Key down: %@",theEvent);
}

@end
--------

The only message I get on the console is the Accept message
the Become message never fires and key strokes always get
the "bell".

What am I missing here?

Thanks,

Jerry
_______________________________________________
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.


  • Follow-Ups:
    • Re: Capturing keydown events in an NSImageView?
      • From: Brent Gulanowski <email@hidden>
  • Prev by Date: Re: Is anyone using an object database?
  • Next by Date: Re: Web Kit
  • Previous by thread: Re: Web Kit
  • Next by thread: Re: Capturing keydown events in an NSImageView?
  • Index(es):
    • Date
    • Thread