NSResponder subclass not getting -mouseDown
NSResponder subclass not getting -mouseDown
- Subject: NSResponder subclass not getting -mouseDown
- From: Hisaoki Nishida <email@hidden>
- Date: Wed, 21 Sep 2005 17:41:51 -0700
Hi,
I have an NSResponder subclass (call it Obj2) that basically renders
an NSString on the currently focused view (Obj1), which it does
perfectly fine. However I have been trying to get this to accept
mouseDown events, and would like to know what I am doing wrong. Obj1
can receive mouseDown events no problem.
I also need Obj2 to know its bounds for clicking, but NSResponder has
no initWithFrame. I just call -init. How should Obj2 know its bounds?
Also, since I am creating a bunch (500+) of Obj2s I wasn't sure if
making a responder chain that long would be a good idea. It doesn't
work anyway with the way I'm doing it:
In Obj2 class:
- (BOOL)acceptsFirstResponder
{
NSLog(@"foo");
return YES;
}
- (void)mouseDown: (NSEvent *)aEvent
{
NSLog(@"bar");
}
Neither logs get called.
If I send [obj1Instance setNextResponder: obj2Instance] -- which I
thought was a sensible thing to do, to make a responder chain -- and
click anywhere inside obj1's view, I get a signal 11 (SIGSEGV).
Thanks for the help.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden