Re: Wait / Busy Cursor
Re: Wait / Busy Cursor
- Subject: Re: Wait / Busy Cursor
- From: Ondra Cada <email@hidden>
- Date: Thu, 25 Apr 2002 21:48:37 +0200
On Thursday, April 25, 2002, at 08:04 , rsharp wrote:
the short answer is: you don't. The wait cursor is controlled by the
Window Server and appears when you application doesn't respond to events
for a given amount of time.
Agreed. But, it would be nice to be able to programatically change the
cursor to a "wait" cursor just as you can do in Carbon.
But why, on earth?
Either the application does response to events, in which case you don't
want the busy cursor (at least I think so!). Or it does not, in which case
you get it automatically.
Most elaborate usage of this scheme I've seen is in PhotoShop when
applying filters. PS always starts out with a wait cursor, but if things
start taking too long, they then display a progress dialog. Works nicely
as they cover all cases (i.e. tasks that are short and long).
That's *quite easy*, not elaborate the slightest. Just implement the
lenghty operation inside an event, with something like
NSDate *began=[NSDate date];
...
for (...) {
if (began && [began timeIntervalSinceNow]<-THRESHOLD) {
[[progressIndicator window] orderFront:self];
began=nil; // no need to do the above twice
}
.... computing, incl. setting the progressIndicator .....
}
[[progressIndicator window] orderOut:self];
That's all. The busy cursor will be shown automatically after a short time
of irresponsivity. After THRESHOLD, you'll add the progress panel.
Incidentally, I still think that the thing should be in a thread (or, if
for a specific operation more proper, cut to a number of idle time tasks),
so that the app remains responsive regardless.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.