* Double Barreled Progress Bar

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
Barnowl
Gold
Posts: 21
Joined: 25 Sep 2014 10:05
Family Historian: V6

Double Barreled Progress Bar

Post by Barnowl » 03 Sep 2015 09:58

In the course of writing a plugin to sort problems with imports from Family Tree Maker, I found I had a situation where several processes happened consecutively, and after incorporating Jane and Mike’s excellent progress bar 8-) , I wondered if I could make it work with an additional Overall Progress bar.
I found it was a really useful introduction to the use of Closures. I have tried to follow the style of the original as much as possible, and the test begins by illustrating unchanged behaviour with the three standard examples. The Overall progress bar is activated by calling ProgressBar.Overall(intMax) which works like a property.
Additional features I incorporated are:
1) Access to the Clock so at the end you can say something like
ProgressBar.Close()
fhMessageBox(“You have done it all!\n\n” .. TimeTaken: “ .. ProgressBar.TimeTaken())
2) Optional independent setting of button text.
3) Optional fixed Info Text line – not flashing past as an activity indicator but conveying very little real info. It also not overloading the heading
4) Simple single call Tick() which combines Message(“Foo”) and Step(1)
5) “Damping” of the progress bar means after reaching 100% it can be about half a second before the bar catches up and hits the buffers. I therefore introduced a half second delay releasing every 0.05 seconds to smooth it. After all, simply by incorporating a progress bar you are saying I am happy for my program to run a bit slower.
Attachments
ProgressTest.fh_lua
(11.86 KiB) Downloaded 211 times
Ian Johnson - researching Bain, Batley, Elsden, Ewen and Johnson families and the village of Easton Royal
(i>

User avatar
tatewise
Megastar
Posts: 27082
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Double Barreled Progress Bar

Post by tatewise » 19 Sep 2015 21:15

I have belatedly given this a little thought.
Certainly as an exercise in understanding closures it will be worthwhile to you.

The features 1) to 4) are handy additions, even for a single Progress Bar.

I recognise the delay mentioned in 5) but not sure about the subsequent suggestions.
Progress Bars are only necessary when there is a lot of data to process, so it is not so much accepting that the Plugin can run slower, but needing to provide the user with confidence that something is happening. I believe it is important that the Progress Bar does not significantly slow the Plugin, and I go to some lengths to minimise their impact. For example, instead of using Step(1) on every loop, I will use say Step(10) every tenth loop. Otherwise, with very large databases, the run time of the Plugin can significantly increase.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply