Re: Progress Indicator Behaviour
Re: Progress Indicator Behaviour
- Subject: Re: Progress Indicator Behaviour
- From: Uli Kusterer <email@hidden>
- Date: Tue, 15 May 2007 01:31:00 +0200
On 15.05.2007, at 00:29, Si Baker wrote:
I have a working programme that displays a large amount of vector
map data on to a CustomView from a NSView - drawrect method. I have
played with various options to include a spinning disk progress
indicator in the view's host window frame and also in a subview to
the Custom view (although not exhaustively). I have also "hinted"
for a new thread for the progress indicator (and confirmed the
additional thread in Activity Monitor) but none appear to work as
expected. (...) or am I missing something or simply wasting my
time? I really thought this would be a lot easier to implement!
This should be really easy. However, maybe you're somehow doing
your processing in the main thread? AFAIK view updates are still
restricted to the main thread. If I'm not mis-remembering that, you
should just do things the other way round: Do your drawings in a
second thread, and leave the main thread able to spin the progress
indicator (and if you use an NSProgressIndicator, that should
actually happen automatically).
What you should do is create an NSImage on your secondary thread,
and whenever you want that redrawn use
performSelectorOnMainThread:...waitUntilDone:YES to trigger a redraw
and make the view draw that NSImage.
Then again, there are ways this may not be necessary. You may want
to look up general programming theory books that talk about "lazy
loading" and "clipping", and have a look at the "dirty rect" that you
get as a parameter to drawRect: (plus that other way to get a list of
rects that need updating, which is even less coarse than that single
update rect).
The fastest way to do work on the computer is still not doing it at
all.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden