Re: NSResponder subclass not getting -mouseDown
Re: NSResponder subclass not getting -mouseDown
- Subject: Re: NSResponder subclass not getting -mouseDown
- From: Andre <email@hidden>
- Date: Thu, 22 Sep 2005 15:50:13 -0700
I think what you wanna be using is an NSView subclass set to be the
subview of Obj1. But since your using 500+ may I suggest NSCell
(NSActionCell)?
You can have tracking rects set to get and receive events from the
superview...
NSResponder and NSView are a bit heavy compared to NSCell.
On 平成 17/09/21, at 17:41, Hisaoki Nishida wrote:
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
_______________________________________________
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