Re: A simple question about nsthread
Re: A simple question about nsthread
- Subject: Re: A simple question about nsthread
- From: Andrea Salomoni <email@hidden>
- Date: Fri, 2 Dec 2005 13:01:32 +0100
Thank you joar,
I checked a lot of simple projects.... and I connected as always all
outlets via IB.
The problem is more complex I think:
As you can read in this tutorial
http://www.cocoadev.com/index.pl?
WorkerThread the developer has a thread and 2 objects: the first
(that is like my controller) ans the second that is like my connector.
In the controller there is the method: [NSTHread
detachThreadSelector:@selector(startConnection:)
withTarger:MYconnector withObject:nil];
In the MYConnector object that is istantiate in the -(id)init
controller's method in this way: MYConnector = [[connector alloc]
init]; I have the method -(void)startConnection(id)owner where I
start the socket connection.
In the connector.h file I declare the IBOutlet NSTextField *
statusField; variable that I use inside the startConnection: method via
[statusField performSelectorOnMainThread:@selector(setStringValue:)
withObject:@"connected"
waitUntilDone:false];
All Apple's documentations and tutorials around and a 3 days google
search returns me always the same... all tutorials start the thread
and perform it in the same class and not as I want to do, because I
would like to use a unique controller with only one nib file, start
all the threads in the controller object and permorf each thread in a
separate class and lock and unlock the threads to syncronize the app.
I think (after a deep search) that the problem is while the nib file
starts. Because maybe the File's owner. But really don't understand
what happen...
Maybe you have some deeper infos about it and some link to share...
or maybe a very simple app where I can see the right functions....
Thank you very much for your all this support
Andrea
Il giorno 01/dic/05, alle ore 12:55, j o a r ha scritto:
On 1 dec 2005, at 12.39, Andrea Salomoni wrote:
Yes I know it.
But the proble is that my variable is an Outlet....
No matter, the principle is the same.
How can I give a value to an Outlet?
Like you would any other variable, but like I said, you would
usually do it via nib loading.
If this sounds difficult or strange, I would suggest that you check
out a couple of simple sample projects where you can play around /
experiment with how nib loading is intended to work.
I know an Outlet is a variable... but which is the reason why in
the main thread the outlet exist and in secondary thread not?
That is not really a valid question, because data are shared
between threads.
My guess is that you're looking at different objects. One of them
have the outlet, and the other object don't. If you had been
looking at the same object, you would not have seen different
"states" for this outlet.
Test this:
NSLog(@"self: %@, outlet: %@", self, myTextField);
j o a r
_______________________________________________
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