• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Updating progress bar from multiple nested functions - best way?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Updating progress bar from multiple nested functions - best way? (From: Johnny Deadman <email@hidden>)

  • Prev by Date: Updating progress bar from multiple nested functions - best way?
  • Next by Date: Click & Hold on NSButton
  • Previous by thread: Updating progress bar from multiple nested functions - best way?
  • Next by thread: Re: Updating progress bar from multiple nested functions - best way?
  • Index(es):
    • Date
    • Thread