Re: getting NSTextView to work
Re: getting NSTextView to work
- Subject: Re: getting NSTextView to work
- From: Todd Ransom <email@hidden>
- Date: Wed, 30 Nov 2005 11:43:11 -0700
Can you post your project somewhere? The problem could be in the code
or in one of the nibs but it's going to be difficult to find without
access to the project.
Todd Ransom
Return Self Software
http://returnself.com
On Nov 29, 2005, at 11:21 PM, Boyd Collier wrote:
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
_______________________________________________
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