Richard, et al:

In my WebMerge product, the main task focuses around a complex process that can take several minutes to complete. In older versions I had my progress bar set to increment once through each item in my loop. Later I found that if I only update it every 20th time through the loop the
smoothness of the progress bar was nearly the same -- but overall
performance nearly doubled! That one line of code for the OS to update the progress bar was costing as much as 500 lines of data slicing and dicing.

Which is why all my progress bars calculate the number of iterations necessary to move the bar one position and update the thumbPosition only when it will change:

    put 0 into recordsProcessed
put round(recordCount/(the width of scrollBar "Progress Scrollbar")) into progressInterval
    put max(1,progressInterval) into progressInterval
    repeat with x=4 to lastRecord
      ... -- process one record
      add 1 to recordsProcessed
if (recordsProcessed mod progressInterval)=0 then set the thumbPosition of scrollBar "Progress Scrollbar" to recordsProcessed
    end repeat

Rob Cozens
CCW, Serendipity Software Company

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to