Questions tagged [nsdocument]

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files.

NSDocument is an abstract class that defines the interface for documents, objects that can internally represent data displayed in windows and that can read data from and write data to files. Documents create and manage one or more window controllers and are in turn managed by a document controller. Documents respond to first-responder action messages to save, revert, and print their data.

Conceptually, a document is a container for a body of information identified by a name under which it is stored in a disk file. In this sense, however, the document is not the same as the file but is an object in memory that owns and manages the document data. In the context of the Application Kit, a document is an instance of a custom NSDocument subclass that knows how to represent internally, in one or more formats, persistent data that is displayed in windows.

A document can read that data from a file and write it to a file. It is also the first-responder target for many menu commands related to documents, such as Save, Revert, and Print. A document manages its window’s edited status and is set up to perform undo and redo operations. When a window is closing, the document is asked before the window delegate to approve the closing.

NSDocument is one of the triad of AppKit classes that establish an architectural basis for document-based applications (the others being NSDocumentController and NSWindowController).

References:

NSDocument Class Reference

479 questions
0
votes
1 answer

NSDocument for relational data / todo list?

I want to create an OS X app where users can edit items from something similar to a todo list - each item has text, status (done/todo), creation date and some other data. The items of the todo list have also relationship with other entities. I…
User
  • 31,811
  • 40
  • 131
  • 232
0
votes
1 answer

Correct way to make an NSView the firstresponder to all Undo/Redo actions irrespective of active/focused view/control

I have a standard document based application whose main window has two NSViews. Is it possible to make NSView1 the firstresponder for Undo/Redo actions even when NSView2 is the focused view. Is it possible to have the context for Edit menuitem…
ClaraU
  • 877
  • 3
  • 11
  • 22
0
votes
2 answers

How do I load PersistentDocuments into the same window

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…
0
votes
2 answers

Catching arguments for creating a new document with a document-based application on MAC

I am working on a document-based application for Mac. This application has its own data model and methods for writing and reading such kind of document. If I want to start this application with a predefined document I can do it in the following way:…
0
votes
1 answer

BNRPersistence on the iPhone, and NSDocument

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…
jammur
  • 1,189
  • 3
  • 10
  • 18
0
votes
1 answer

Strange Bug:thanks, but I need to control my own subviews

2014-11-08 17:24:46.487 Intelligent Notes[4472:303] APP-reportExceptionthanks, but I need to control my own subviews 2014-11-08 17:24:46.488 Intelligent Notes[4472:303] thanks, but I need to control my own subviews 2014-11-08 17:24:46.494…
John Chen
  • 27
  • 6
0
votes
0 answers

Writing a python list and reading in swift

I'm writing a custom python plugin for my software. It takes a List, JSON serializes it, then writes it to a file. Now, I want to create an OSX app that can read that file. Can someone point me in the right direction to do this? I'm very fluent in…
JoeBayLD
  • 939
  • 2
  • 10
  • 25
0
votes
1 answer

conceptual help with sending data to global hud, Cocoa

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…
theprojectabot
  • 1,163
  • 12
  • 19
0
votes
0 answers

Restore Document with multiple Window Controllers

So i have a Document that's tab based (think of it like the xcode tabs) using and sharing one API-Core object between them. If i've closed it with 2 Windows, one with tab "A" and one with tab "B" and reopen it should create 2 Window Controllers and…
thomasguenzel
  • 670
  • 7
  • 25
0
votes
1 answer

Select File Name created with Date and Time for later use?

NSString *dateString= [self currentDateandTime]; //create file path and file name NSString *docDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; NSString *pdfPath = [docDirectory…
Avis
  • 505
  • 4
  • 14
0
votes
1 answer

Do I need to override the writing methods of NSDocument in subclasses for an application that will only be a viewer for files

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…
Abizern
  • 146,289
  • 39
  • 203
  • 257
0
votes
2 answers

How do I import, instead of open, files for a NSDocument-based app?

I'm a newbie trying out a web-browser app, using WebKit with the NSDocument architecture (as in some of the WebKit reference code). I have it opening a pre-set home page, then post the current URL to an adjacent text field, then have the WebView…
CTMacUser
  • 1,996
  • 1
  • 16
  • 27
0
votes
2 answers

Present a view modally in NSDocument's window

I have an NSDocument subclass that has its own xib file. Also I have an NSViewController subclass with its own xib file too, and I want to present its view modally, like this one. Problem is, it always shows it as a separate floating window without…
Randex
  • 770
  • 7
  • 30
0
votes
1 answer

How can I create NSDocument (subclass) instances for a viewer-oriented app?

I'm trying out Cocoa (on OS X Mavericks) with a NSDocument-oriented app with a (planned) WebKit control. I noticed that the "New" menu command is disabled if all the document types are Viewer or Other. I'm making a web browser, so the app…
CTMacUser
  • 1,996
  • 1
  • 16
  • 27
0
votes
0 answers

How can I save a NSTextField in CoreData?

I have found this video that explain how to save using core data, when you are using a NSTable. https://www.youtube.com/watch?v=9Du_6By97sM&list=PLE83F832121568D36&index=31 But I'm trying to have just a collection of Form elements, like NSTextField…
Daniel P
  • 2,439
  • 3
  • 20
  • 27