• 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 question (newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton question (newbie)


  • Subject: Re: NSPopUpButton question (newbie)
  • From: Charilaos Skiadas <email@hidden>
  • Date: Thu, 10 Mar 2005 10:11:43 -0600

On Mar 10, 2005, at 3:57 AM, j o a r wrote:


On 2005-03-10, at 10.08, Aaron Boothello wrote:

Is it possible to have more than one item in an NSPopUpButton with the same title (NSString) ?

The documentation states:

========================================================
- (void)addItemWithTitle:(NSString *)title
Adds an item named title to the end of the menu. If an item with the name title already exists in the menu, it’s removed, and the new one is added.
========================================================


So it's probably not a good idea. You might manage to add an item with a duplicate title if you access the menu directly, I don't really know, but consider that if you do, these methods might fail / no longer do what you expect:

I wanted to implement a "history list" pop-up button with text commands that the user typed, so I wanted to allow multiple items, and so I accessed the menu directly. It worked fine, though I never have to remove an item from the list or any the following commands either. So depends on what you want to do with it I guess.



- (void)removeItemWithTitle:(NSString *)title
- (void)selectItemWithTitle:(NSString *)title
- (id <NSMenuItem>)itemWithTitle:(NSString *)title
- (int)indexOfItemWithTitle:(NSString *)title
- (void)setTitle:(NSString *)aString

j o a r

Haris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSPopUpButton question (newbie)
      • From: Rudi Sherry <email@hidden>
    • Re: NSPopUpButton question (newbie)
      • From: j o a r <email@hidden>
References: 
 >NSPopUpButton question (newbie) (From: Aaron Boothello <email@hidden>)
 >Re: NSPopUpButton question (newbie) (From: j o a r <email@hidden>)

  • Prev by Date: Re: Asymmetrical behavior in NSMutableArray
  • Next by Date: Re: get the application on the Finder "Open With..." menu?
  • Previous by thread: Re: NSPopUpButton question (newbie)
  • Next by thread: Re: NSPopUpButton question (newbie)
  • Index(es):
    • Date
    • Thread