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

NSPopUpButton displayed item - selected item


  • Subject: NSPopUpButton displayed item - selected item
  • From: Henning Sauerland <email@hidden>
  • Date: Fri, 15 Apr 2005 16:54:26 +0200

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


  • Follow-Ups:
    • Re: NSPopUpButton displayed item - selected item
      • From: Henning Sauerland <email@hidden>
  • Prev by Date: Re: Self terminating popup window - need help
  • Next by Date: Re: Self terminating popup window - need help
  • Previous by thread: Re: Generating default values in a bindings controlled Tableview
  • Next by thread: Re: NSPopUpButton displayed item - selected item
  • Index(es):
    • Date
    • Thread