RE: nstimer not firing?
RE: nstimer not firing?
- Subject: RE: nstimer not firing?
- From: "Christopher Hickman" <email@hidden>
- Date: Wed, 7 Sep 2005 10:51:19 -0400
When you use
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: it puts the
timer into the default runloop in the default mode. I think what you need
to do is this instead:
- (void)awakeFromNib
{
m_tUpdate = [NSTimer timerWithTimeInterval:(0.5)
target:self selector:@selector(updateMess:) userInfo:NULL
repeats:TRUE];
[[NSRunLoop currentRunLoop] addTimer:m_tUpdate
forMode:NSModalPanelRunLoopMode];
}
Try that and see if it works.
Topher
-----Original Message-----
From: cocoa-dev-bounces+tophu=email@hidden
[mailto:cocoa-dev-bounces+tophu=email@hidden] On Behalf Of Luc
Vandal
Sent: Wednesday, September 07, 2005 9:54 AM
To: cocoa Dev
Subject: Re: nstimer not firing?
Well it seems that the modal loop keeps the timer from firing. As
soon as I close the dialog the timer fires. How can I set a timer
within a modal dialog?
Luc
On 6-Sep-05, at 8:59 PM, Christopher Hickman wrote:
> Other than having NULL instead of nil and TRUE instead of YES, this
> should work. Note also that the run loop retains the timer, so
> unless you need to message it outside of your updateMess: method,
> you don't need to keep it.
>
> On Tuesday, September 06, 2005, at 07:10PM, Luc Vandal
> <email@hidden> wrote:
>
>
>> Hi,
>>
>> I have a timer that I set in awakeFromNib but it's never firing:
>>
>> - (void)awakeFromNib
>> {
>> m_tUpdate = [[NSTimer scheduledTimerWithTimeInterval:(0.5)
>> target:self selector:@selector(updateMess:) userInfo:NULL
>> repeats:TRUE] retain];
>> }
>>
>> - (void)updateMess:(NSTimer*)t
>> {
>> ...
>> }
>>
>>
>>
>> Am I doing something wrong?
>>
>> Luc
>>
>> _______________________________________________
>> 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
>>
>>
>
_______________________________________________
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
_______________________________________________
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