how to Progress Bar?

Sarah Reichelt sarahr at genesearch.com.au
Wed Feb 16 17:45:14 EST 2005


> I guess this question has been asked a 1000 times before, but I will 
> ask it again just in case you all missed it!
> How do you get a progress bar to work?
> I have looked for example stacks and  docs but can't find anything!
>
> Any help would be great Thanks.................
>
Remember that a progress bar is just a type of scrollbar so check the 
docs for scrollbars and see what you get. The main properties you need 
are startvalue, endvalue & thumbPos. Here is an example script:

on mouseUp
   set the startvalue of scrollbar "Progress" to 0
   set the endvalue of scrollbar "Progress" to 100
   repeat with c = 1 to 100
     -- do loop stuff
     set the thumbPos of scrollbar "Progress" to c
   end repeat
end mouseUp

Drawing a progress bar takes a while, so if you have a lot of repeats, 
it's best not to draw every time you go through the loop e.g.

   repeat with c = 1 to 1000
     -- do loop stuff
     -- update progress bar every 10th time through
    if c mod 10 = 0 then set the thumbPos of scrollbar "Progress" to c
   end repeat

Cheers,
Sarah



More information about the use-livecode mailing list