• 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 displayed item - selected item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton displayed item - selected item


  • Subject: Re: NSPopUpButton displayed item - selected item
  • From: Henning Sauerland <email@hidden>
  • Date: Mon, 18 Apr 2005 09:42:54 +0200

After another search, I found some other people obviously having the same problem, but likewise no solution has been given :-/


Am 15.04.2005 um 16:54 schrieb Henning Sauerland:

I'm pretty new to Cocoa and have a problem with the NSPopUpButton.

The selected item is correctly saved in the preference-file, but the NSPopUpButton doesn't display the selected item when I open the preference panel, instead the first item is shown.

As said in the documentation "selectItemWithTitle" invokes "synchronizeTitleAndSelectedItem" to ensure that the item being displayed agrees with the selected item. If I understand it right, this should exactly do what I'm looking for, but it won't work for me.


Here's a sketch of the code:

NSUserDefaults *prefs;
IBOutlet NSPopUpButton *profileSelect;

- (IBAction)savePrefs:(id)sender; {
[prefs setObject:[profileSelect titleOfSelectedItem] forKey:@"SelectedProfile"];
}


- (void)openPrefs {
[profileSelect selectItemWithTitle:[prefs objectForKey:@"SelectedProfile"]];
}




Henning


_______________________________________________ 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
References: 
 >NSPopUpButton displayed item - selected item (From: Henning Sauerland <email@hidden>)

  • Prev by Date: Localized nib file does not get loaded
  • Next by Date: Error inserting object at arranged index
  • Previous by thread: NSPopUpButton displayed item - selected item
  • Next by thread: Hide/Show
  • Index(es):
    • Date
    • Thread