Re: Updating progress bar from multiple nested functions - best way?
Re: Updating progress bar from multiple nested functions - best way?
- Subject: Re: Updating progress bar from multiple nested functions - best way?
- From: j o a r <email@hidden>
- Date: Mon, 18 Apr 2005 15:15:12 +0200
On 2005-04-18, at 14.45, Johnny Deadman wrote:
I want to put up a progress indicator BUT the process is split up
between many independent objects which don't know about each other and
don't know whether the job they're doing (eg formatting a paragraph,
analysing a scene) is a one-shot or part of a bigger picture.
If you want to have a determinate progress indicator you need to know
the scope of the operation in advance. It doesn't sound like you have
this information in your current implementation. You would probably
need to add some sort of pre-flight step, where you compute how many
separate steps are involved in the operation, and perhaps also their
relative "weight".
It seems wrong to have to pass each object a reference to the progress
bar, the proportion of the task completed, and the proportion of the
task they are responsible for. It seems equally wrong to insist that
each object retain a reference to the top-level object and notify it.
I feel they should be agnostic about the context from which they are
invoked.
I would probably investigate using some sort of "progress delegate".
This would in practice be the same thing as a reference to the parent,
but might on a conceptual level be cleaner. By using the delegate, a
child could communicate it's current status, and have this status
propagated upwards for display to the user.
If you operate in a context where there is no need to indicate
progress, you could just skip the pre-flight step and not set a
progress delegate.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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