on 2008-06-17 9:36 PM, Markus Spoettl at [EMAIL PROTECTED] wrote: > Also, if that data is it stored on a per document basis, is it stored > as a part of the document data or in the user defaults data. Storing > in the user default database (or someplace else) would remember all > documents opened by a user but not influence the look and feel if its > opened by someone or somewhere else.
If the configuration of the views is a matter of individual user preference and not necessarily tied to the current content of the document, it is customary to use NSUserDefaults and, for bindings, NSUserDefaultsController. Cocoa even uses the user defaults database for you for things like window size and position, if you call -[NSWindow setFrameAutosaveName:], perhaps in your -awakeFromNib implementation. For other configuration settings, just code it yourself. For example, I have a window that shows streaming content, and at the bottom of the window there is a slider that regulates how much content is allowed to show in the window at any one time (discarding the excess on the fly). Whenever the slider is adjusted, the current setting of the slider is stored directly in the user defaults database, and it is retrieved from there when needed, using a combination of bindings and code. The setting is remembered between runs of the program, and different users of the machine can maintain different settings. But if the configuration of the views reflects the current content of the document, such as the setting of a text field, checkbox or slider that displays document content, then you would subclass NSWindowController or use bindings in conjunction with the document's data to make sure the settings in the view match the current content of the document. There may be gray areas. I can imagine situations where the size and position of the window, for example, might depend upon current document content, and in that kind of situation you would want to make sure the document content controls the window size and position so they will appear correctly when the same document is opened by another user, perhaps on another computer. You might then, optionally, also update the settings in the user defaults database, if it would be useful or convenient to allow other features of your application to retrieve a window's current size and position from the user defaults database instead of from the document itself. This might be convenient, for example, if you are locking an ancillary window or palette to the main document window's current position on screen. See Apple's document "User Defaults Programming topics for Cocoa." -- Bill Cheeseman - [EMAIL PROTECTED] Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com PreFab Software - www.prefabsoftware.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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]