Re: Catching a click during a loop
Re: Catching a click during a loop
- Subject: Re: Catching a click during a loop
- From: Mark Williams <email@hidden>
- Date: Mon, 1 Aug 2005 08:18:39 -0700
On Jul 31, 2005, at 10:13 PM, Charilaos Skiadas wrote:
On Jul 31, 2005, at 11:24 PM, Mark Williams wrote:
Thanks to every one for the help thus far.
I have run into a new problem with the thread now. First off, I am
able to cancel the process now that it's on a new thread. That
part works. The problem is that while the new thread is working it
updates a textfield in a window pretty regularly with file
information. This information is getting all garbled as if the
text that was there is not being removed even though I do a
setStringValue:@" " between each update. How do I fix this?
Are you using setStringValue on the worker thread? All UI update
should be done in the main thread. If that is the problem, you have
to use NSObject's
Yes, that is what I was doing.
performSelectorOnMainThread:withObject:waitUntilDone:modes:
So it would be something like [textField
performSelectorOnMainThread:@selector(setStringValue:)
withObject:@"File info string" waitUntilDone:YES modes:???
What goes in the modes?
Thank you for the information
Mark.
Mark
On Jul 31, 2005, at 8:10 AM, Mark Williams wrote:
Thank you for the link.
I'll read it over and see what I can learn from it. Thanks
Mark.
On Jul 30, 2005, at 11:18 PM, John Stiles wrote:
Just FYI, threading isn't a small tweak. You do need to use a
thread in order to solve your problem, but there are a lot of
things you need to know first.
You should probably spend an hour or two and read about it
before writing too much code:
http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/index.html#//apple_ref/doc/uid/10000057i
(There might be better resources as well; this was one of the
best links I could pull up after searching for a minute or two.)
On Jul 30, 2005, at 10:40 PM, Mark Williams wrote:
Ok. I will move it to a new thread. I tried that before and it
made no difference before but I must have done it wrong. I
think I know where the mistake there was.
Thanks,
Mark.
On Jul 30, 2005, at 8:26 PM, Cameron Hayne wrote:
On 30-Jul-05, at 10:42 PM, Mark Williams wrote:
Ok, well it's not taking the click at all until after the
loop finishes.
So I guess I'm wondering what I did wrong in this loop that I
cannot click cancel.
It sounds like your loop is in the main thread instead of
being on a separate thread. If it were on a separate thread,
it wouldn't affect the main thread.
--
Cameron Hayne
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:
40blizzard.com
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:
40fornextsoft.com
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:
40math.uchicago.edu
This email sent to email@hidden
Haris
_______________________________________________
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