Re: Attaching a menu to a view
Re: Attaching a menu to a view
- Subject: Re: Attaching a menu to a view
- From: Ryan Stevens <email@hidden>
- Date: Thu, 14 Nov 2002 21:59:03 -0800
On Thursday, November 14, 2002, at 01:02 PM, Yong Lee wrote:
>
How do you attach a menu to a view?
>
>
The view method - (NSMenu *)menuForEvent:(NSEvent *)theEvent
>
or
>
responder method - (void)setMenu:(NSMenu *)aMenu
>
>
only seems to work when the control key is pressed (as a contextual
>
menu). Is there a way for menu to appear when the view is clicked
>
without a modifier key?
>
In your mouseDown try this:
[NSMenu popUpContextMenu:[self menu] withEvent:theEvent forView:self];
Alternatively you could do something with NSPopUpButton, I think. I
haven't tried toying with it but I'd bet it would be easy enough to
customize it to your liking.
Anyway, HTH! :-)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.