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 


Gradient Progress Bar

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Aug 03, 2002 1:05 am    Post subject: Gradient Progress Bar Reply with quote

I like this for something different than the old progress bar.
Just basically set %%Percent to whatever percent you want and gosub GradBar.
%%GBWidth holds the width of the progress bar. Change that to fit your needs.
Code:

OPTION DECIMALSEP,"."
OPTION SCALE,96
Title GradientBar
  DIALOG CREATE,Gradient Progress Bar,-1,0,365,88
REM *** Modified by Dialog Designer on 6/22/02 - 00:30 ***
  DIALOG ADD,BUTTON,BUTTON1,18,5,355,35
  DIALOG ADD,GROUP,GROUP1,21,8,348,28
  REM 343
  DIALOG ADD,GRADIENT,GradBar,23,10,0,23,BLUE,WHITE,,LEFTTORIGHT
  DIALOG ADD,BUTTON,Example1,60,118,64,24,Example1
  DIALOG ADD,BUTTON,Example2,60,185,64,24,Example2
  DIALOG SHOW
  DIALOG DISABLE,BUTTON1
  %%GBWidth = 343
:Evloop
  wait event
  goto @event()
:GradBar
  %%Width = @FDIV(@FMUL(%%Percent,%%GBWidth),100)
  %%Width = @FORMAT(%%Width,5.0)
  DIALOG SETPOS,GRADBAR,23,10,%%Width,23
  exit
:Example1BUTTON
  %%Percent = 0
  repeat
    wait 0.5
   %%Percent = @FADD(%%Percent,10)
   gosub GradBar
  until @EQUAL(%%Percent,100)
  goto evloop
:Example2BUTTON
  %%Percent = @FMUL(@VOLINFO(C,F),100)
  %%Percent = @FDIV(%%Percent,@VOLINFO(C,S))
  %%Percent = @FORMAT(%%Percent,3.0)
  gosub GradBar
  info %%Percent"%" of Drive C: is Free.
  goto evloop
:Close
  exit

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat Aug 03, 2002 1:28 am    Post subject: Reply with quote

Maybe try this approach (based on Sheep's code):

Code:

  title GradientBar
  option decimalsep,.
  dialog CREATE,Gradient Progress Bar,-1,0,365,88
  rem *** Modified by Dialog Designer on 6/22/02 - 00:30 ***
  dialog ADD,BUTTON,BUTTON1,18,5,355,35
  dialog ADD,GROUP,GROUP1,21,8,348,28
  dialog ADD,GRADIENT,GradBar,23,10,343,23,BLUE,WHITE,,LEFTTORIGHT
  dialog ADD,TEXT,Cover,23,10,343,23
  dialog ADD,BUTTON,Example1,60,118,64,24,Example1
  dialog ADD,BUTTON,Example2,60,185,64,24,Example2
  dialog SHOW
  dialog DISABLE,BUTTON1
  %%gbwidth = 343
:Evloop
  wait event
  goto @event()
:GradBar
  %%width = @format(@fmul(@fdiv(%%Percent,100),%%gbwidth),5.0)
  %%coverwidth = @diff(%%gbwidth,%%width)
  if @zero(%%coverwidth)
    dialog hide,Cover
  else
    dialog setpos,Cover,23,@sum(%%width,10),%%coverwidth,23
    dialog show,Cover
  end
  exit
:Example1BUTTON
  %%percent = 0
  repeat
    wait 0.1
    %%percent = @fadd(%%Percent,5)
    gosub GradBar
  until @equal(%%Percent,100)
  goto evloop
:Example2BUTTON
  %%percent = @fmul(@volinfo(C,F),100)
  %%percent = @fdiv(%%Percent,@volinfo(C,S))
  %%percent = @format(%%Percent,3.0)
  gosub GradBar
  info %%Percent"%" of Drive C: is Free.
  goto evloop
:Close
  exit
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Mon Aug 05, 2002 10:24 am    Post subject: An update ! Reply with quote

I added a percentage in the middle of the progress bar, so that it changes colour from black to white and also tracks the percentage.


Code:
title GradientBar
  option decimalsep,.
  dialog CREATE,Gradient Progress Bar,-1,0,365,88
  rem *** Modified by Dialog Designer on 6/22/02 - 00:30 ***
  dialog ADD,BUTTON,BUTTON1,18,5,355,35
  dialog add,style,style1,,,,,WHITE
  dialog ADD,GROUP,GROUP1,21,8,348,28
  dialog ADD,GRADIENT,GradBar,23,10,343,23,DKBLUE,DKBLUE,,LEFTTORIGHT
  dialog ADD,TEXT,Cover,23,10,343,23
  dialog ADD,BUTTON,Example1,60,118,64,24,Example1
  dialog ADD,BUTTON,Example2,60,185,64,24,Example2
  dialog add,text,perw,28,175,40,15,0 %,,style1,transparent
  dialog add,text,perB,28,175,40,15,0 %,,transparent
  dialog SHOW
  dialog hide,perw
  dialog DISABLE,BUTTON1
  %%gbwidth = 343
:Evloop
  wait event
  goto @event()
:GradBar
  %%width = @format(@fmul(@fdiv(%%Percent,100),%%gbwidth),5.0)
  %%coverwidth = @diff(%%gbwidth,%%width)
  if @zero(%%coverwidth)
    dialog hide,Cover
  else
    dialog setpos,Cover,23,@sum(%%width,10),%%coverwidth,23
    dialog show,Cover
  end
  exit
:Example1BUTTON
  %%percent = 0
  repeat
    wait 0.1
    %%percent = @fadd(%%Percent,1)
   if @greater(%%percent,50)
   dialog show,perW
   dialog hide,perb
   else
   dialog show,perB
   dialog hide,perw
   end
   dialog set,perw,%%percent %
   dialog set,perb,%%percent %
    gosub GradBar
  until @equal(%%Percent,100)
  goto evloop
:Example2BUTTON
  %%percent = @fmul(@volinfo(C,F),100)
  %%percent = @fdiv(%%Percent,@volinfo(C,S))
  %%percent = @format(%%Percent,3.0)
  gosub GradBar
  info %%Percent"%" of Drive C: is Free.
  goto evloop
:Close
  exit
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Mon Aug 05, 2002 8:42 pm    Post subject: Reply with quote

Setting both Gradient colors to DKBLUE kind of defeats the purpose of using a Gradient Smile
Good addition though.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code 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