• 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
Re: Displaying a non-contentual menu & attachPopUpWithFrame
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Displaying a non-contentual menu & attachPopUpWithFrame
      • From: Eric Gorr <email@hidden>
    • Re: Displaying a non-contentual menu & attachPopUpWithFrame
      • From: Kyle Sluder <email@hidden>
References: 
 >Displaying a non-contentual menu & attachPopUpWithFrame (From: Eric Gorr <email@hidden>)

  • Prev by Date: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !
  • Next by Date: Re: NSDirectoryEnumerator and URLs (PS)
  • Previous by thread: Displaying a non-contentual menu & attachPopUpWithFrame
  • Next by thread: Re: Displaying a non-contentual menu & attachPopUpWithFrame
  • Index(es):
    • Date
    • Thread