• 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: NSPopUpButton questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton questions


  • Subject: Re: NSPopUpButton questions
  • From: Paul Bruneau <email@hidden>
  • Date: Sun, 6 Dec 2009 14:11:23 -0500

On Dec 6, 2009, at 12:29 PM, Andy Lee wrote:

> On Dec 6, 2009, at 11:34 AM, Matt Neuburg wrote:
>> On Sat, 5 Dec 2009 20:29:25 -0500, "email@hidden" <email@hidden>
>> said:
>>> The Apple docs for NSPopUpButtons says to avoid accessing it's NSMenu directly
>> because it may need to do housekeeping.
>>
>> Where do the Apple docs say that? I'm thinking there might be some
>> misunderstanding lurking here. m.
>
> Indeed, there are a few methods where the docs specifically recommend accessing the menu directly, e.g.:
>
> <http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSPopUpButton_Class/Reference/Reference.html#//apple_ref/occ/instm/NSPopUpButton/insertItemWithTitle:atIndex:>
>> Since this method searches for duplicate items, it should not be used if you are adding an item to an already populated menu with more than a few hundred items. Add items directly to the receiver's menu instead.

Yeah, but the OP is right, the Application Menu and Pop-up List Programming Topics for Cocoa says this:

> To implement its menu, the button cell contains an NSMenu object, which in turn contains several NSMenuItem objects, one for each item in the menu. Avoid invoking methods on the NSMenu object directly, but instead invoke methods on theNSPopUpButton instance, which may need to do some housekeeping before invoking the appropriate methods on the menu. However, you can retrieve the menu with the NSPopUpButton method menu. The NSPopUpButton methods you use most often are the methods that tell you which item is selected.

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MenuList/Articles/HowMenusWork.html

I have to say this has never stopped me from molesting the menu directly. But I disagree with the HIG on popup menus so I'm often on the wrong side of the law regarding this topic._______________________________________________

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: NSPopUpButton questions
      • From: Andy Lee <email@hidden>
References: 
 >Re: NSPopUpButton questions (From: Matt Neuburg <email@hidden>)
 >Re: NSPopUpButton questions (From: Andy Lee <email@hidden>)

  • Prev by Date: [MEET] CocoaHeads-NYC this Thursday (*note location*)
  • Next by Date: Re: Best way to hook into the run loop?
  • Previous by thread: Re: NSPopUpButton questions
  • Next by thread: Re: NSPopUpButton questions
  • Index(es):
    • Date
    • Thread