Re: NSPopUpButton displayed item - selected item
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