On 2011-09-09, at 6:05 PM, Kyle Sluder wrote:

> Unfortunately, it doesn't look like there's any public API to force a
> document to be locked. The closest I've come is -[NSDocument
> checkAutosavingSafetyAndReturnError:], but it doesn't seem to be
> called at all the times I'd expect it to be called (for example, a new
> document), and returning NO doesn't put the Locked text in the
> titlebar; it just prohibits the user from making any changes without
> duplicating. Likewise, returning YES from -isInViewingMode just makes
> it impossible to make any changes to the document.

When I try returning NO from checkAutosavingSafetyAndReturnError:, it does put 
"Locked" in the title bar for a newly opened existing document (on 10.7.2). Not 
sure why you would want to do this for a newly created document, though. But 
the frameworks seem to maintain their own state after checking this. The user 
may then unlock the document, and it will stay unlocked until it is closed. It 
will be locked again when reopened (if you are still returning NO).

Not sure if this helps with your problem. I'm just trying to understand the 
behavior myself, and thinking out loud.

Dave

_______________________________________________

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 arch...@mail-archive.com

Reply via email to