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

Re: Little problem with NSPopUpButton


  • Subject: Re: Little problem with NSPopUpButton
  • From: Mike Ferris <email@hidden>
  • Date: Sat, 28 Dec 2002 10:26:55 -0800

This is very true.

Tags or representedObjects can often be a better choice than raw index for dealing with popups. I especially recommend representedObjects in cases where there is, in fact, some object that each item represents.

For example, in the PropertyListEditor application, the popup used to select the class of a node actually uses the Class objects for each plist type as the representedObject of the items in the menu. When someone chooses an item the action method just asks for the representedObject of the selected item and it has the class that the user wants that item to be.

Mike


Begin forwarded message:

From: James DiPalma <email@hidden>
Date: Fri Dec 27, 2002 2:10:19 PM US/Pacific
To: Cocoa List <email@hidden>
Subject: Re: Little problem with NSPopUpButton

From: Mike Ferris <email@hidden>
However, as Rakesh said, the more normal way to do what you want is with -indexOfSelectedItem.

Localization may affect your decision. I think that some popups will change their item ordering when localized (e.g. listing days of a week from Sunday-Saturday in America may get reordered in other localizations). Maybe this one case is so uncommon that it only affects this one type of popup data.

Some people use index, some people use tags; both work:
[sender indexOfSelectedItem]
[[sender selectedItem] tag]


-jim
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Re: Little problem with NSPopUpButton (From: James DiPalma <email@hidden>)

  • Prev by Date: Re: Debugging with zombies enabled
  • Next by Date: Re: Using NSCell to bold cells in a tableview
  • Previous by thread: Re: Little problem with NSPopUpButton
  • Next by thread: SOAP Server
  • Index(es):
    • Date
    • Thread