Re: Displaying a non-contentual menu & attachPopUpWithFrame
Re: Displaying a non-contentual menu & attachPopUpWithFrame
- Subject: Re: Displaying a non-contentual menu & attachPopUpWithFrame
- From: Peter Ammon <email@hidden>
- Date: Wed, 13 Jan 2010 11:59:14 -0800
Hi Eric,
On SnowLeopard and later, use the NSMenu method popUpMenuPositioningItem: atLocation: inView:.
Before SnowLeopard, this is probably the easiest way:
NSPopUpButtonCell *cell = [[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO];
[cell setMenu:menu];
[cell performClickWithFrame:NSMakeRect(menuLoc.x, menuLoc.y, 0, 0) inView:theView];
[cell release];
Hope this helps,
-Peter
On Jan 13, 2010, at 9:38 AM, Eric Gorr wrote:
> In the 'Application Menu and Pop-up List Programming Topics for Cocoa' document it says:
>
> The preferred approach for programmatically displaying a non-contextual menu is to create an NSPopUpButtonCell object, set its menu, and then call send a attachPopUpWithFrame:inView: message to the pop-up button cell.
>
> I was wondering if anyone was aware of some sample code demonstrating this technique.
>
> Thank you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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