Updating progress bar from multiple nested functions - best way?
Updating progress bar from multiple nested functions - best way?
- Subject: Updating progress bar from multiple nested functions - best way?
- From: Johnny Deadman <email@hidden>
- Date: Mon, 18 Apr 2005 08:45:55 -0400
They say if you are finding something difficult in Cocoa you are doing it wrong so so... I probably am.
I have an autoformat routine for my screenplays which is complicated and takes a while. When the user chooses 'autoformat', the format manager creates a parser which parses the screenplay, which in turn splits it into paragraphs, normalizes the text, performs context-free and context-dependent analysis, builds a structure representing the screenplay, and passes it back to the format manager, which replaces the appropriate text and applies the appropriate formatting.
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.
Moreover, the whole process is handled by an object (the format manager) which philosophically I do not feel should handle any interaction. It might, for example, be called in the absence of a UI and do its job perfectly well. (It's invoked in turn from an IBAction in the main editor window's controller).
So what is the best way to handle a progress bar in this case?
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.
--John Brownlow Deep Fried Films, Inc
|
_______________________________________________
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