• 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
Adding an event handler to an NSView subclass using categories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding an event handler to an NSView subclass using categories


  • Subject: Adding an event handler to an NSView subclass using categories
  • From: "Arthur C." <email@hidden>
  • Date: Fri, 04 May 2007 16:54:39 +0200

Hello,

I make use of a graph-view class (which is a subclass of NSView) to display graphs.
I want to add some features to be called from a contextual menu, i.e. when someone does a control-click on the graph, a menu pops up and some methods can be called.


As it is a third-party class with no source code, I have added a 'category' which has a method
- (NSMenu *) menuForEvent: (NSEvent *) theEvent;


This works fine - well, about half of the times. Sometimes the control-click does give the menu, sometimes not. After experimenting quite a bit, there's still no pattern telling when it will or won't work...

So my question is whether this approach is valid? Or do I need to subclass the graphView class?
Does it have something to do with the existing graphView code (to which I have no access)?


Thanks in advance,

Arthur C.

_________________________________________________________________
Talk with your online friends with Messenger http://www.join.msn.com/messenger/overview


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Adding an event handler to an NSView subclass using categories
      • From: Yann Bizeul <email@hidden>
  • Prev by Date: How to limit clickable area in custom NSOutlineView cell?
  • Next by Date: NSURLRequest or alternative & structuring data for use with NSBrowser? (Total Noob questions...)
  • Previous by thread: How to limit clickable area in custom NSOutlineView cell?
  • Next by thread: Re: Adding an event handler to an NSView subclass using categories
  • Index(es):
    • Date
    • Thread