forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Correct use of a progress bar (Where can they be used)

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Fri Jun 24, 2005 9:02 am    Post subject: Correct use of a progress bar (Where can they be used) Reply with quote

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?

Embarassed *ME CONFUSID* Embarassed
Back to top
View user's profile Send private message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Fri Jun 24, 2005 9:29 am    Post subject: Reply with quote

Very Happy DIALOG ADD,PROGRESS,PROGRESS1, ...

You can create checkpoints with this DIALOG SET,PROGRESS1, ...
Back to top
View user's profile Send private message Send e-mail
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Fri Jun 24, 2005 9:57 am    Post subject: Reply with quote

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
View user's profile Send private message
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Jun 24, 2005 12:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Jun 24, 2005 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
DW
Contributor
Contributor


Joined: 21 Mar 2003
Posts: 175
Location: UK

PostPosted: Fri Jun 24, 2005 3:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Fri Jun 24, 2005 3:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Fri Jun 24, 2005 3:49 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group