Adding an event handler to an NSView subclass using categories
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