• 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
Newbie:accessing NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie:accessing NSTextView


  • Subject: Newbie:accessing NSTextView
  • From: Boyd Collier <email@hidden>
  • Date: Sat, 19 Nov 2005 14:01:07 -0800

I've written a simple document-based program following much of Ch 26 of Hillegass but with the following changes: In the document window that appears as a result of opening a file with some data in it, I've added a button, and when this button is pressed, control is passed to a controller that extracts the data from the text view in the window and carries out some computations on it. All this works just as I expect. Then within the same controller, I allocate a new document and create a new window controller from a nib file. The document controller is added to the list maintained by the application's document controller. There is also a .m file for the document created by initWithWindowNibName for the output document and this is essentially the same as the source code file for the document that goes with the window that displays the data which is to be analyzed.

When I run the program, the data file is successfully opened, the data shown in it is successfully extracted and manipulated, and the window in which the results of analysis are to be placed appears and is editable. I can type in it, move it, resize it, etc. and I can do a "save as..." on it from the file menu, but the text that I type is not saved. I've tried everything I can think of to get access to the text that I type into the output window via the NSTextView that is in the window within the nib file but without success. It seems like this should be straight forward, since I can programmatically manipulate the window (as demonstrated by [outputWindow center] shown below).

The following code snippet shows what I've done to create the output window. If anyone can offer some suggestions of what I should be looking at (and believe me, I've read just about everything in Apple's documentation), I would be extremely grateful.

Boyd


NSDocumentController *dc = [NSDocumentController sharedDocumentController];
OutputDocument *myOutputDocument;
myOutputDocument = [[OutputDocument alloc] init];
NSWindowController *outWindowController = [[NSWindowController alloc] initWithWindowNibName:@"outputWindow"];
if (outWindowController) {
[myOutputDocument addWindowController:outWindowController];
NSLog(@"outWindowController was added");
[myOutputDocument showWindows];
}
[dc addDocument:(NSDocument *)myOutputDocument];
NSWindow *outputWindow = [outWindowController window];
[outputWindow center]; // just to verify that the window I created can be manipulated


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: conversion between NSEvent timestamp and absolute time?
  • Next by Date: Re: adding Foundation framework to a Carbon application
  • Previous by thread: conversion between NSEvent timestamp and absolute time?
  • Next by thread: Unable to load palette?
  • Index(es):
    • Date
    • Thread