Hi
I have an app that allows the user to add items to a PopUpButton via a textField. What I am unable to do is to use NSUserDefaults to save items added to it. Since NSPopUPButton is an array, I thought NSUserDefaults will generate a plist file in which the data can be saved an loaded upon launch.
Could anyone help me please
Thanks,
t.
Here is some of my code:
property popupButton : missing value
property textField : missing value
property theLabel : missing value
on awakeFromNib()
popupButton’s addItemsWithTitles_({“alpha”, “Beta”, “Gamma”})
popupCount’s setIntValue_(popupButton’s numberOfItems())
theLabel’s setStringValue_(popupButton’s titleOfSelectedItem)
set defaults to current application's NSUserDefaults's standardUserDefaults()
set defaultValues to {|PopUp|:"0", popupButton:""} -- starts with values on
defaults's registerDefaults_(defaultValues)
popupButton's setTitle_(defaults's valueForKey_("PopUp"))
end awakeFromNib