Re: contextual menu for NSCell in NSOutlineView
Re: contextual menu for NSCell in NSOutlineView
- Subject: Re: contextual menu for NSCell in NSOutlineView
- From: Scott Ruda <email@hidden>
- Date: Mon, 13 Sep 2004 15:39:16 -0700
On Sep 13, 2004, at 1:25 PM, Ondra Cada wrote:
On 13.9.2004, at 20:23, Scott Ruda wrote:
... I've also overridden menuForEvent: in the outline view, but it is
never called. The ADC documentation for these messages seems to be
pretty sparse with no mention of use cases.
Hmmm... you sure? I did it many times with a table view and once or
twice with an outline view, and it always did work like a charm -- the
basic principle (extending a delegate services for that) was something
like
@interface OCSAddPopupMenuToAnyTableView:NSTableView @end
@implementation OCSAddPopupMenuToAnyTableView
-(NSMenu*)menuForEvent:(NSEvent*)evt {
...
Oops, my mistake in the posting! I tried overriding NSCell's
menuForEvent:inRect:ofView: not NSOutlineView's menuForEvent:. It's the
one in NSCell that never gets called.
I assumed that the outline view would drill into the cells by itself,
essentially like your code does, and then would call NSCell's
menuForEvent: selector, and by default return the menu set with
setMenu:. Apparently not.
I was going back and forth trying to figure out if I needed to do the
deed in the outline view or in the cell. You're well factored code
shows me exactly what I needed and works great. Thanks.
I'm still left trying to understand the role of NSCell's
menuForEvent:inRect:ofView: and setMenu: selectors. Are they just
convenience stubs that are never called by the standard frameworks?
_______________________________________________
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