Re: Interface not receiving messages until action method completes
Re: Interface not receiving messages until action method completes
- Subject: Re: Interface not receiving messages until action method completes
- From: Laurent Michel <email@hidden>
- Date: Wed, 4 Jan 2006 07:54:19 -0500
You are tying up the main thread inside the play method of the music
object. So the message loop cannot react to inbound events like
- redraw request
- window resizing
- or any other kind of events
You should run the play method in a separate _thread_. Check the
NSThread documentation. Detach a thread and run play on music within
that thread and all will be fine. (or course, the music object will
be shared by the two threads, so be careful and synchronize where
needed).
On Jan 3, 2006, at 10:11 PM, F. C. Rock wrote:
Much appreciate help with this:
I click on a button on my interface. The button is connected to the
following action:
- (IBAction)play:(id)sender
{
[self cueMusic: nil];
[music play];
return;
}
cueMusic is an action connected to another button on the same
interface. It highlights the button.
The problem is that "cueMusic:" button doesn't get highlighted
until after the program returns from -play:.
I also have a clock displayed on this interface and the display
ceases to update until after the program returns from -play:.
Can anyone tell me what's happening here - and how to fix it?
Fred
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40thorgal.homelinux.org
This email sent to email@hidden
--
Laurent
_______________________________________________
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