NSTextField update and multithreaded app
NSTextField update and multithreaded app
- Subject: NSTextField update and multithreaded app
- From: Christian Mike <email@hidden>
- Date: Wed, 8 Aug 2001 16:23:09 -0500
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.