Versions in OSX 10.7

I enabled versions and autosave in my document-based application, so now I can see the version browser (time-like interface) for each of my documents in OSX 10.7

+ (BOOL)autosavesInPlace{ return YES; } 

I have a text view in it and, as suggested in one of the WWDC videos, session 107, I want to disable text input, etc. when entering the browser version. So I applied the NSWindowDelegate methods:

 - (void)windowWillEnterVersionBrowser:(NSNotification *)notification{ [myTextView setEditable:NO]; } - (void)windowWillExitVersionBrowser:(NSNotification *)notification{ [myTextView setEditable:YES]; } 

Now myTextView in the document (current document) on the left side of the screen is disabled, but the documents on the right side (versions of previous versions) still show the cursor.

TextView is not editable, but shows the cursor. I also turned off other things and included them again in the above methods, but writing code in the above methods seems to affect only the current document / document window, not past versions of windows / document.

Maybe someone else has a problem? How can I get this working right? :)

EDIT :

I searched for sample 107 session WWDC code, but the folder is empty. Am I missing something or not sample code for this session?

Edit2

The release note for the Application Kit (Lion) says that when creating windows on the right side of the version browser, windowForSheet is windowForSheet :

 - (NSWindow *)windowForSheet{ CustomWindow *win = (CustomWindow *)[super windowForSheet]; [win setUserInteractionEnabled:![self isInViewingMode]]; //disable stuff here return win; } 

But now, when the window returns from the browser version, user interaction is still disabled. : (

+6
source share
1 answer

I finally found the answer:

NSWindowDelegate is called for the current document window (the document on the left side of the version browser), and other windows can be coordinated by redefinition -[NSDocument windowForSheet]; or even better, writing something like this inside -[NSDocument windowControllerDidLoadNib:]; .

I posted a short guide / notes here: Versions in OSX 10.7

+5
source

Source: https://habr.com/ru/post/893661/


All Articles