• 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
getting NSTextView to work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting NSTextView to work


  • Subject: getting NSTextView to work
  • From: Boyd Collier <email@hidden>
  • Date: Tue, 29 Nov 2005 22:21:44 -0800

This is a restatement of a question that I posed some time ago. I received some suggestions, but still can't seem to make things work as they seem like they should.

I'm (still) trying to create a document-based application in which there can be 2 windows, both used to show text. One window will show data to be analyzed, the other will show the results of the analysis. The first window has, in addition to a NSTextView where the data to be analyzed appears, a button, which, when hit, brings up the other window to show the output from the analysis. I've created a nib file for each; i.e. each of these nibs contains the appropriate window with NSTextView and a controller. My code works fine for opening the first window when the program is launched, I can open a data file into it, save the changes if I want to, etc. and when I hit the button, the second window appears as it should, and I can type into it. Moreover, I can access the text in the first window via the NSTextView in it and process the data as I want. However, even though I've put an outlet in the controller for the second window and connected it to the NSTextView in the second window, the NSTextView always points to nil. Below is a snippet of code showing what I do to create the controller for the second window. This is only one of a great many permutations I've tried to get things to work, and I'm now fresh out of ideas. And yes, I've looked at lots of sample code and read what would seem to be the appropriate documentation, though obviously, I'm still not understanding something that seems like it should be simple but doesn't work. If anyone out there in cocoa-land has some suggestions, I would really appreciate hearing from them.



NSDocumentController *sdc;
sdc = [NSDocumentController sharedDocumentController];
OutWindowController *outWindowController = [[OutWindowController alloc] initWithWindowNibName:@"outputWindow"]
OutputDocument *myOutputDocument;
myOutputDocument = [[OutputDocument alloc] init];

if (outWindowController)
{
[myOutputDocument addWindowController:outWindowController];
NSLog(@"MyWindowController was added");
[myOutputDocument showWindows];
}

[sdc addDocument:(NSDocument *)myOutputDocument];

NSWindow *outputWindow = [outWindowController window];

if ([outWindowController outWindowTextView] == nil)
NSLog(@"theTextView is nil"); // always is nil; but why??
_______________________________________________
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
  • Follow-Ups:
    • Re: getting NSTextView to work
      • From: Todd Ransom <email@hidden>
  • Prev by Date: NSArrayController predicate not working
  • Next by Date: Warnings that won't go away
  • Previous by thread: NSArrayController predicate not working
  • Next by thread: Re: getting NSTextView to work
  • Index(es):
    • Date
    • Thread