PDA

View Full Version : Progress Bar



Jfp87
02-07-2015, 01:13 AM
Hi guys,

Looking for a bit of help regarding a cosmetic aspect of my code - a progress bar. I have read some of the stuff out there on progress bars, but from what I can see, it's not always straight-forward depending on how your code operates.

My code will be processing on average 10 documents, each filled with a varying number of CC's & bookmarks. My initial thought was that I could create an array which holds information about the number of CC's & bookmarks within each document, and then when the code runs, it can calculate the number of CC's & bookmarks in advance using the array. The progress bar can be incrementally advanced based on the number of CC's & bookmarks populated. To me, this seems like it would dynamically create the progress bar based on the specific documents which are being processed.

Any ideas on how to implement this, better ideas or am I completely wrong?

Thanks,
Joe

Bob Phillips
02-07-2015, 02:38 AM
My experience of a progress bar is that it doesn't really matter that it is totally accurate, just that it shows things are moving along. So say that you assume that there are 20 documents and and 50 CCs and bookmarks, then if one document only has 20 of such, that part of the PB will only get to 40% before it starts again on the next one - who cares, they see it is on the next document. Same with the number of documents.

BTW, I am assuming you have two bars on your form, one overall for the docs, another that restarts for each doc for the CCs and bookmarks.

Jfp87
02-07-2015, 03:00 AM
Yeah, well my plan was to have the progress bar for the overall progress. Underneath would simply be text telling the user which document was being processed.

How would I go about updating the progress bar based on CC's/bookmarks populated? I've seen an example on the web of a progress bar which is based on the number of paragraphs in the document, the bar is then progressed based on the current paragraph which is being processed.

I am a bit unsure how to perform a similar operation for CC's/bookmarks.

Joe

gmayor
02-07-2015, 07:21 AM
Unless you have the total count to work from, you cannot create a single progress bar that accurately reflects the count at a given point.

In the case where you have a number of documents with a number of processes that you want to count, you have several choices

1. Display two progress bars - one to count the documents, the other to count the processes in document.

or

2. Use a progress bar to display the document count, and use text on alabel under of over the progress bar (or use the title bar) to indicate the progress within the document

or

3. Start a new progress bar for each process and list the document count on the label.

Bear in mind that all the processing of the bar detracts from the speed of the whole process. So, if I was doing it, I would probably just ...

4. Show the document count in the progress bar and forget the second count.

Jfp87
02-07-2015, 08:09 AM
Thanks for the responses. I will have a go and see what I come up with.

Joe