Re: Using NSDocument with NSViewControllers

2008-10-23 Thread Ross Carter


On Oct 23, 2008, at 3:07 AM, Paul Thomas wrote:

Before I set off down the road to frustrating deadendsville, has  
anyone any experience with trying to coerce AppKit's document  
architecture into a single window interface - i.e. using tabviews in  
stead of separate windows?


A sneaky look at a couple of apps shows that people have usually  
resorted to completely custom classes, but I'd like to use  
NSDocument if possible - just with views instead of windows.


Is it possible?



I've done it, although my implementation is not yet bug-free. Smarter  
developers might know an easier way, but for me it was a lot of work,  
and I can't say that I saved any effort by working with NSDocument  
instead of a custom class. FWIW, here are some of the methods I had to  
override:


NSWindowController -document, -windowDidLoad, -windowWillClose:, - 
windowDidResignMain:, -windowDidBecomeMain:, -windowDidResize:


NSDocumentController -openDocumentWithContentsOfURL:display:error:, - 
openUntitledDocumentAndDisplay:error:, - 
makeUntitledDocumentOfType:error:, - 
reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo 
:


NSDocument - 
canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:


The biggest problem was window closing behavior and making sure the  
user gets prompted to save changes for each document in the window.


I didn't use NSViewController.

Ross
___

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]


Using NSDocument with NSViewControllers

2008-10-23 Thread Paul Thomas
Before I set off down the road to frustrating deadendsville, has  
anyone any experience with trying to coerce AppKit's document  
architecture into a single window interface - i.e. using tabviews in  
stead of separate windows?


A sneaky look at a couple of apps shows that people have usually  
resorted to completely custom classes, but I'd like to use NSDocument  
if possible - just with views instead of windows.


Is it possible?

ta,
pt. 
___


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]