I am trying to work on NSDocument, so I tried the Building a Text Editor in 15 Minutes example in the Text System Overview reference.
I did some changes to code which was suggested, such as used property and synthesize in place of declaring and defining accessor methods.
I followed each step written in the reference but could not imple...
Hi,
I am working on a text editor and I want to add RTFD support. After adding the RTFD file type to my Info.plist, I got the message that "readFromFileWrapper:ofType:error: must be overridden for your application to handle file packages."
I had a look around in the documentation and found some things, but I didn't manage to do everyth...
Doc based, QTKit app. When saving, the new filename updates in the active window titleBar. I would also like to display the newly saved filename string in a textField, somewhere else on the opened doc. The code successfully saves the new doc. However the lastPathComponent string doesn't update. Please advise?
thanks,
Paul
- (void)save...
I have an NSDocument-based Cocoa app and I have a couple of secondary threads that I need to terminate gracefully (wait for them to run through the current loop) when the users closes the document window or when the application quits. I'm using canCloseDocumentWithDelegate to send a flag to the threads when the document is closing and th...
I'm creating a cocoa app with NSDocument architecture. Now I'm trying to save some data to a plist file inside dataOfType:error. Strange enough, every property in my document instance prints null when I try to access it inside that method.
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError{
NSLog(@"dataOfType was cal...
I'm a bit confused regarding the document architecture. Lets look at MSN for Mac - what would the document be in that application? The contact list? The text we insert to talk to other people?
When the need comes to save or read data into the application, what type of data should it read? Contact lists or chat logs?
Update:
Pushing thi...
I've an application that holds a main window with a list of items, and from that window an undetermined number of windows can be opened. Each of those windows can hold several instances of a model object, with those instances listed in a drawer.
I started my project by making the (main window) list of items extend NSDocument and each ot...
I've got to be missing something simple, but Google is not helping.
My file saves and loads fine. (I've overridden dataOfType to get some stuff in it.) Then I override fileWrapperOfType (in preparation for creating a bundle), and I get a "The document 'Untitled' could not be saved as 'test'." sheet when I try to save. Even when I empty ...
I'm trying to create a "project"-like document, in that it contains subdocuments in a specified directory. I'd like a brand new save of a document to set up that directory with appropriate subdirectories. I'd like a "Save As" to copy all those subdirectories and any files within them to the new location. But I'd like a "Save" to only upd...
I'm trying to print a document. The document is an array of NSImageReps, or a single NSPDFImageRep, which has multiple pages. I'm having trouble figuring out how to use the NSPrintOperation class to print this.
The NSPrintOperation seems to need an NSView to print. Do I need to manually add each image into the view at a calculated pos...
I'm writing a document-based Cocoa app that's basically a graphical editing program. I want the user to be able to show/hide non-modal windows (such as an inspector window). Since these windows would be shown/hidden from menu items, where is the "best" place to implement the actions, such as - (IBAction)toggleInspector:(id)sender?
I'v...
I'm creating an NSDocument application, with two document types: Website and Web Service. This is in my Info.plist:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Website</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>website</string>
</array>
<key>LSTypeIsPackage...
I think I may be missing the obvious but I'm not sure.
The section on subclassing NSDocument in the docs states that subclasses of NSDocument must override one reading and one writing method.
If I'm creating a viewer application that will not write anything back, do I still need to override a writing method (returning what, nil?) or ca...
Hello all!
I have a multidocument application.
I want to pull data from each of those documents and mirror a subset of the data into a global 'management' HUD window that can sit on another screen.
Do I need a global object of my HudController in each document instance or is there a way I can delegate all the info from the various doc...
Okay, I'm fairly new to Cocoa and Objective-C, and to OOP in general.
As background, I'm working on an extensible editor that stores the user's documents in a package. This of course required some "fun" to get around some issues with NSFileWrapper (i.e. a somewhat sneaky writing and loading process to avoid making NSFileWrappers for ev...
I'm trying to get BNRPersistence running in an iPhone app, but I'm having a problem that I have no idea how to solve. Keep in mind I'm relatively new to iPhone dev.
The problem is that BNRStoreDocument subclasses NSDocument, which exists in the Cocoa framework and thus isn't available on the iPhone. So obviously I'm getting compile erro...
I want to open NSPersistentDocuments and load them into the same window one at a time. I'm almost there but missing some steps. Hopefully someone can help me.
I have a few saved documents on the hard drive. On launch my app opens to an untitled NSPersistentDocument and creates a separate NSWindowController. When I press the button t...
I have a document based application. Saving the document can take a few seconds, so I want to enable the user to continue using the program while it saves the document in the background.
Due to the document architecture, my application is asked to save to a temporary location and that temporary file is then copied over the old file. How...
I am working on a document-based Cocoa application. At startup, the user is presented with a "welcome panel" (of type NSPanel) with buttons for common actions like "Create New Document" and "Open Existing Document". These actions are linked to the first responder's newDocument: and openDocument: actions, respectively, just like the match...
Is there a way to add an item that doesn't point to a file that exists on the file system to the "Open Recent" menu?
In an application not based on NSDocument, I can add an item to the "Open Recent" submenu with the following code:
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL URLWithString:stringToFi...