On Dec 3, 2010, at 1:43 PM, [email protected] wrote:

> from observation ...
> 
> when items are removed the toolbar state is written to user defaults and this 
> state determines the toolbar configuration on the next program run.
> 
> so, should I remove the NSToolbar entry from user defaults at terminate time 
> so the items will appear on next run?
> 
> is this the Cocoa way or should something else be done?
> 
> -koko
> 
> 
> On Dec 2, 2010, at 9:34 PM, John Joyce wrote:
> 
>> 
>> On Dec 3, 2010, at 1:15 PM, [email protected] wrote:
>> 
>>> I programatically removed some toolbar items based on a state of the 
>>> program.
>>> 
>>> I quit the program.
>>> 
>>> I ran the program again with the state set to not remove the toolbar items.
>>> 
>>> The items remained removed !
>>> 
>>> They are in the toolbar in the xib.
>>> 
>>> I have cleaned the project and rebuilt and removed the code to remove the 
>>> items suspecting that perhaps the sate was incorrect.
>>> 
>>> The items are still not displayed.
>>> 
>>> Is there some hidden toolbar reference ?
>>> 
>>> -koko
>>> 
>>> 
>>> _______________________________________________
>>> 
>>> Cocoa-dev mailing list ([email protected])
>>> 
>> If you use NSUserDefaults to store the state, it will keep it that way on 
>> the next launch.
>> So you also need to consider what state to have on launch. Default? Last 
>> state before Quit?
>> Generally, maintaining last user-chosen state between launches is a good 
>> idea.
>> 
>> 
>> 
> 
> _______________________________________________
> 
This is normal behavior. 
Most Cocoa apps utilizing NSToolbar will have a user-customizable set of 
toolbar items.
Many users will never customize anything.
Others will always customize things.

The normal way to do things is to maintain the state that the user chooses.

Keep in mind that the common paradigm is that each user would use a separate 
user account on the system. One reason is because they will have different 
preferences.

It is possible that you could develop an app that requires per-session 
configuration, or admin-only configuration, such as a kiosk app. This is 
unusual though.

You should provide a way to restore the default set of toolbar items. The 
NSToolbar class already does this for you.

In earlier versions of Mac OS the NSToolbar class required much more effort on 
your part to programmatically handle much of these things. This is no longer 
true. 

If you need to clear things for testing, learn about the defaults command line 
tool. You can clear all defaults for an app if need be.
If you are storing any preferences in some other plist file, you may need to 
manually delete that file.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to