Document/Controller Object Confusion
Document/Controller Object Confusion
- Subject: Document/Controller Object Confusion
- From: Tom Gray <email@hidden>
- Date: Mon, 15 Sep 2003 14:59:26 -0400
Hello,
I am trying to create a Document architecture application. My problem
seems to be that the document pointed to by my controller does not
point back to the original document. It points to a void or null
document.
My NSDocument subclass is:
@interface CDTextEditorDocument : NSDocument
{
NSString *fileVersion; // The Crewdog Software file format version.
NSString *frameString; // The document window's frame.
NSMutableData *docData; // The document's data.
}
-(NSData *)docData;
-(void)setDocData:(NSData *)theData; // Sets the documents data to the
supplied data.
- (NSString *)frameString;
- (void)setFrameString:(NSString *)newFrameString;
- (NSString *)fileVersion;
- (void)setFileVersion:(NSString *)newFileVersion;
@end
When I open a previously created document the Init method of my
document is executed and an object returned by self, shortly thereafter
loadDataRepresentation:ofType calls initWithCoder which instantiates
yet another document. It is this second document which is connected to
my controller.
Obviously I have done something wrong.
The big picture here is that I have a VT-100 Terminal containing data,
when the user clicks a button it creates an editable document
containing the current VT-100 screen. (That is why I had to subclass
NSDocument.) I then want to use the normal document architecture to
archive the data and screen position to disk.
Thanks!
Tom
_______________________________________________
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.