• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Subclassing NSWindowController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSWindowController


  • Subject: Re: Subclassing NSWindowController
  • From: Dietrich Epp <email@hidden>
  • Date: Thu, 5 Dec 2002 02:50:50 -0800

On Thursday, December 5, 2002, at 02:16 , Chaffinch wrote:

Hi,

I am writing a text editor as a way of learning Cocoa. I want to customise
the window title to display the full path name. I have managed to implement
this by subclassing NSWindowController and overriding the
windowTitleForDocumentDisplayName method. So far so good. I have also
overridden MyDocument's makeWindowControllers method to create the window
controller and call addWindowController. So far so good.

Only now, opening or saving a document no longer works??

I have read through the Apple docs, and have made the NSTextView member
(previously owned by the document) a member of the subclassed
NSWindowController. And overridden windowDidLoad in an attempt to load the
document.

Am I correct in thinking that I still need the loadDataRepresentation and
dataRepresentaionOfType methods in the document class to load and save the
document but that the actual displaying is now done by the windo controller?

Let's go through the motions...

1) Document class. It should have the loading / saving / window-creating code.

2) Subclass of NSWindowcontroller. Created like (in document class):

- (void)makeWindowControllers {
_myWindowController = [[[MYWindowController alloc] init] autorelease];
[self addWindowController:_myWindowController];
}

Any problems here? Part II: connections

What do you mean by that loading & saving doesn't work? Specifics help, such as 'Save' and 'Open' are disabled, or 'Save' doesn't write files.

If the last line is missing from above, 'save' should be disabled, and opened documents should not show any data. How does your document read the text? Through an IBOutlet or similar connection? This won't work with window controllers, the connection will go to the window controller.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Subclassing NSWindowController (From: Chaffinch <email@hidden>)

  • Prev by Date: Re: Debugging Cocoa Apps
  • Next by Date: Re: using the GPL Quake code in a commercial game
  • Previous by thread: Subclassing NSWindowController
  • Next by thread: Re: Subclassing NSWindowController
  • Index(es):
    • Date
    • Thread