• 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 addItemsWithTitles is way slow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton addItemsWithTitles is way slow


  • Subject: Re: NSPopUpButton addItemsWithTitles is way slow
  • From: Jeremy Dronfield <email@hidden>
  • Date: Fri, 16 Aug 2002 13:37:27 +0100

On Friday, August 16, 2002, at 01:54 am, Dave Camp wrote:

There must be a way of doing this without a performance penalty. What am I doing wrong?

The main thing you're doing "wrong" is going against Apple's interface guidelines, which recommend NSPopUpButtons for lists with 5-12 items. 20-50 items is pushing it, whereas 200 items...? For big collections, they suggest using a scrollable list, unless window space is a serious problem.

All NSPopUpButton methods for adding/removing items call -synchronizeTitleAndSelectedItem, which logically has to search for and remove any duplicates. With 200 items there's inevitably going to be a time penalty. You could try calling the equivalent -add methods for NSPopUpButtonCell (which - I think - don't sychronize), but I'm not sure how you'd go about it, and Apple recommends against doing it.

BTW, I posted the code you adapted. It's intended for an NSMenu, where there's no synchronization issue. I adapted it from the MenuMadness example project. If performance is a big issue, and you don't have space for a scrollable list, I'd suggest putting your countries list in an NSMenu.
-Jeremy

=======================================
email@hidden // email@hidden
The Alchemy Pages:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSPopUpButton addItemsWithTitles is way slow [solved - sort of]
      • From: Dave Camp <email@hidden>
    • Re: NSPopUpButton addItemsWithTitles is way slow
      • From: Dave Camp <email@hidden>
References: 
 >NSPopUpButton addItemsWithTitles is way slow (From: Dave Camp <email@hidden>)

  • Prev by Date: [ANN] PdfCompress 0.6b
  • Next by Date: RE: Programming style (was Accessors) revisited ; de-compiler ???
  • Previous by thread: NSPopUpButton addItemsWithTitles is way slow
  • Next by thread: Re: NSPopUpButton addItemsWithTitles is way slow
  • Index(es):
    • Date
    • Thread