NSTimer problem with event run loop
NSTimer problem with event run loop
- Subject: NSTimer problem with event run loop
- From: Matt Reagan <email@hidden>
- Date: Tue, 6 Dec 2005 11:10:03 -0800
Hi all,
I'm very new to Cocoa and Obj. C (and this mailing list), please
forgive me if I've overlooked the obvious with this question.
I'm having problems with an NSTimer that triggers a refresh for a
custom NSView. I have a window with a custom NSView subclass and a
timer that redraws it to make a very simple animation while the window
is sitting on the screen. The animation is just a few RectFill calls,
and eats up very little CPU, but it seems to interfere with event
processing.
What happens is that the animation will run just fine, but when I
click in a menu or on a button, there is a very noticeable 'lag' or
delay before the event with "click in" and be processed, ie you will
click a menu and nothing will happen for a second before finally the
menu will pop down under the cursor.
I've put the Timer in every run loop mode I can think of, I've tried
every way of refreshing the view I can think of, I've changed the
timer firing rate from very slow to very fast (same results), and I've
narrowed the problem to the actual internal refreshing of the NSView.
Somehow the updating of the view seems to overload the runloop or
cause events to delay before they can be processed.
But, even if in the view's drawRect method I remove ALL custom drawing
code, I still have the problem, meaning that the actual animation and
drawing isn't causing the delay, its caused internally somehow with
some kind of timing aspect with the NSview's refresh.
I've read everything I can find on NSTimer and RunLoop and event
handling but can't seem to figure out a way to get the timer to fire
and animate without blocking and lagging other events from being
processed, regardless of which runloop mode the timer is put into.
Hope I provided enough info, any suggestions would be very much
appreciated!! Thank you, everyone!
_______________________________________________
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