• 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
Re: NSResponder subclass not getting -mouseDown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NSResponder subclass not getting -mouseDown (From: Hisaoki Nishida <email@hidden>)

  • Prev by Date: Re: Retrofitting CoreData
  • Next by Date: CoreData Exception: Could not fulfill a fault
  • Previous by thread: NSResponder subclass not getting -mouseDown
  • Next by thread: removing NSManagedObject: a conceptual bug in my app
  • Index(es):
    • Date
    • Thread