Re: NSTextField update and multithreaded app
Re: NSTextField update and multithreaded app
- Subject: Re: NSTextField update and multithreaded app
- From: Brendan Younger <email@hidden>
- Date: Thu, 9 Aug 2001 01:28:00 -0500
On Wednesday, August 8, 2001, at 04:23 PM, Christian Mike wrote:
This may have been addressed here before, but the Apple archive is
currently
down.
I have an NSTextField that functions as a message window to the user.
It is
uneditable and unselectable. Because this is a multithreaded
application, I
set up an NSConnection and a proxy that points to the class that has an
outlet to this text field. I then created a method that sets the text of
this field using setStringValue:.
At the beginning of the application initialization process from the
AppKit
thread (during awakeFromNib for this class), I invoke the method and
pass in
a string that says "Initializing". I then start other threads that do
some
of their own initialization. At the end of the process, one of the
threads
invokes the method through the proxy and passes in a string that says
"Ready".
Now, once the application is up and running, this NSTextField almost
always
says "Initializing", but upon rare occasions, it will say "Ready". Now,
if I
hide the application and restore it so that the NSTextField is forced to
redraw, it displays the proper "Ready" message.
How can I get this text field to update properly during the
initialization
process?
I know for a fact that things happen in the proper sequence ("Init",
Thread
launch, "Ready" from thread) because of NSLog messages. I have tried
various
combinations of awakeFromNib and applicationDidFinishLaunching.
Thanks.
Michael Christian
Thomson multimedia Inc.
I cannot say that you have actually run into any sort of problem. If
you don't see the "Initializing..." string, that means that your
secondary thread has finished before the window made it to the screen.
Nothing wrong with that at all.
Brendan Younger