views:

139

answers:

2

I programatically create an NSToolbar in my application. I just added a new button to the toolbar and added that button to the default configuration of the toolbar. When I run my application the new button is not shown by default. That's because I already have been using the program and I already have a plist file in which this new button is not setup to be shown.

So my question is how can I get the toolbar to reset its current configuration back to the default configuration so that my button will be shown automatically for people who have been using the application.

I guess I could delete the entries in the plist file to force the program to recreate them and thus use the default configuration... but I was hoping there was was some command I could issue to reset it. I didn't see one in the NSToolbar class.

Thanks for any help.

A: 

Well I deleted the appropriate key in the plist file and it worked. I'd still rather know a better way so if you have any better ideas let me know.

regulus6633
A: 

If you add a new button to your toolbar's default configuration it will not appear for users which have customized the toolbar and have settings stored in the user defaults.

If you want to force the new default toolbar on users which have perviously customized the toolbar, changing the autosave name (by appending a version number, for example) is the way to do so. (Consider whether you want to blow away your user's toolbar customizations though.)

Jim Correia
Thanks Jim. That's a much simpler idea than mine and it targets the same principle... change the preferences. I'll use your idea. The button is part of an important new feature so I feel it needs to be shown.
regulus6633