| View previous topic :: View next topic |
| Author |
Message |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Fri Jun 24, 2005 9:02 am Post subject: Correct use of a progress bar (Where can they be used) |
|
|
Ok,
My question for today is about progress bars. Can they be used anywhere and how can they be effectivly implimented?
So how do you create a progress bar and how does it know the progress of the job its doing?
*ME CONFUSID*  |
|
| Back to top |
|
 |
filip Valued Contributor


Joined: 07 Aug 2004 Posts: 340
|
Posted: Fri Jun 24, 2005 9:29 am Post subject: |
|
|
DIALOG ADD,PROGRESS,PROGRESS1, ...
You can create checkpoints with this DIALOG SET,PROGRESS1, ... |
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Fri Jun 24, 2005 9:57 am Post subject: |
|
|
I know how to create a progress bar, what I meant was how do i update the progress of a job to that bar.
I have been manually writing code that increments it, but that seems lame. Is there a generic way to write a good progess bar that will show a program loading, list building, etc?
Thank you |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Jun 24, 2005 12:36 pm Post subject: |
|
|
| Code: |
dialog create,Progress Demo,-1,0,300,100
dialog add,TEXT,T1,10,10,280,15
dialog add,PROGRESS,Pr1,30,10,280,20
dialog show
list create,1
%x = 0
REM Add 50 items to string list
repeat
list add,1,List item %x
%x = @succ(%x)
until @equal(%x,50)
REM Now loop thru list displaying the text for each item
REM and updateing the progressbar
%x = 0
repeat
dialog set,T1,@item(1,%x)
dialog set,Pr1,@div(@prod(@succ(%x),100),50)
wait 0.25
%x = @succ(%x)
until @equal(%x,@count(1))
wait event
exit
|
Very simple example of how to implement a progressbar. Hope this will
give you the general idea. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Jun 24, 2005 12:42 pm Post subject: |
|
|
Better explain the progress code ::
| Code: |
@div(@prod(@succ(%x),100),50)
|
%x = is the position of our counter (incremented by one)
50 = is the total count of items to process
Always increment %x with @succ() or by adding one, because even when
your job is finished, the progressbar will not display 100% progress. Hope
this makes sense. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
DW Contributor

Joined: 21 Mar 2003 Posts: 175 Location: UK
|
Posted: Fri Jun 24, 2005 3:29 pm Post subject: |
|
|
Thank you very much, thats a fine example.
If i have a list and i load a large file into it, could i use this same example to implement a progress bar?
I have tried. The way i did it was to load file into a hidden list and then, moved the items on by one to the main list, this is where i showed my progress bar.
The problem is, i wait 2 min for the hidden list to load before the program starts counting for the main list.
how can I track the progress of the list loadfile command? |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri Jun 24, 2005 3:36 pm Post subject: |
|
|
you will need to keep in mind that the progress bar only accepts integers and will not work with decimals
for example, setting the progress bar 30.1 will not work, but setting 30 will
serge _________________
|
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Jun 24, 2005 3:49 pm Post subject: |
|
|
To my knowledge ther is no way to track the loading of a file into a string
list, as the command doesn't return until the operation is finished.
| DW wrote: |
If i have a list and i load a large file into it, could i use this same example to implement a progress bar? |
Yes you can. Just remember that the 50 in my example is the total number
of items to process. You should change this to however many items are in
your string list, or you can replace it with @count(listName). _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|