Re: [basic] retain an NSTextView object and update a window
Re: [basic] retain an NSTextView object and update a window
- Subject: Re: [basic] retain an NSTextView object and update a window
- From: Jaime Magiera <email@hidden>
- Date: Thu, 2 Jan 2003 10:37:47 -0500
This is for my SOAP application. After the incoming SOAP message gets
parsed, the method name defined in that message gets called.
My first task is to get two copies of the application "talking" to each
other. In other words, type the text in one client, hit send, and the
receiving application speaks/writes the string. So I need the window of
the receiving client to update the view without any buttons being
pushed.
incoming SOAP message -> parse -> run the method
Jaime
On Thursday, January 2, 2003, at 05:12 AM, David Rio Vierra wrote:
-awakeFromNib is sent to any object that is created from a nib, after
every object from that nib has been created and all connections have
been made. You would initialize objects connected through IBOutlets
in -awakeFromNib rather than in an -init... method, since IBOutlets
aren't yet connected in -init.... If you try to send messages to your
sendTextView before the nib has been completely set up, chances are
sendTextView will be nil and nothing will happen. Just
curious...where are you trying to call -speakAndDisplayText: from
other than as a button's action?
On Wednesday, January 1, 2003, at 11:29 PM, Jaime Magiera wrote:
Ok, I must be doing something wrong. I connected the window's
NSTextView to NSTextView outlets in several controller classes at
once -- just to see what's going on. The following code works fine
from every controller class -- IF it's called from a NIB object
(Button, etc.) or any "awakeFromNib" method:
[speechView setString:@"called from soap responder in the awake from
nib method"];
The same goes for the calling the following method I wrote into the
window's initial controller class:
- (IBAction)speakAndDisplayText:(id)sender
{
NSString *aString = @"Made it to the speak and display";
[sendTextView setBackgroundColor:[NSColor redColor]];
[sendTextView setString:aString];
[sendTextView setNeedsDisplay:YES];
[sendTextView startSpeaking:self];
}
This function works when called in any "awakeFromNib" method in any
of the application classes (with the proper connection made in IB,
thanks). However, it doesn't work when called from within any OTHER
method, in any other class.
I must have the right NSTextView instance to be able to change it in
the "awakeFromNib" calls. What's the difference between that and any
other method in a class?
Totally lost,
Jaime
On Thursday, January 2, 2003, at 12:32 AM, David Rio Vierra wrote:
The second time, you're probably calling those methods on some other
instance of aWindowController. The object you created in Interface
Builder, represented by that blue cube, is one instance of it, and
it is the one with a connection to the NSTextView. If you want
other objects to use that same instance of aWindowController, you'll
have to connect them in IB using an IBOutlet in the other objects..
You generally don't need to retain any user interface elements,
other than windows that will never be used again once closed. .
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.