RE: KeyDown Events in NSImageView Subclass?
RE: KeyDown Events in NSImageView Subclass?
- Subject: RE: KeyDown Events in NSImageView Subclass?
- From: Richard Jackson <email@hidden>
- Date: Tue, 17 Dec 2002 09:24:01 -0800
To answer my own question:
Apparently you need to have the NSImageView "Editable" flag turned ON to
be able to become a First Responder. When I added:
[self setEditable:YES];
to my awakeFromNib: I started getting my keyDown events!
Note: the docs only describe setEditable: as an enable for dragging new
images into the frame - and since I didn't want drag 'n drop I had left
"Editable" in it's default "NO" state. After setting it to "YES" to receive
key events, I then had to reject drags by overriding draggingEntered:
- (unsigned int) draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationNone;
}
- Richard
-----Original Message-----
From: Richard Jackson [
mailto:email@hidden]
Sent: Monday, December 16, 2002 12:47 PM
To: email@hidden
Subject: KeyDown Events in NSImageView Subclass?
I have a subclass of NSImageView where I would like to receive KeyDown
events (I want to be able to use the "arrow" keys to move a cursor around my
image). I've overridden acceptsFirstResponder: to return YES - and I see it
get called, but I never get keyDown messages (instead I get a "purr" sound
when I press a key, which I assume means "nobody home"...?). I've tried
making myImageView "first responder", but still no luck.
Can NSImageViews (or their subclasses) be made to receive keyDown events?
If so, can anyone give me a clue?
TIA,
- Richard Jackson
_______________________________________________
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.