Mac Professional Member
Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Aug 09, 2002 6:33 pm Post subject: Gradients in VDS3 (no DLL)... |
|
|
Here's a color gradient for VDS3. This is a progress bar
example, accurate to 1%...
Requires %%percent var value (or it will clear).
Change the %%startcolor var to try different colors
(use no leading zeros, and no "$").
Change only the following vars to change the progress
bar's location and size when creating the Dialog:
%%pbx, %%pby, %%pbw, %%pbh
Check the remarks for more info. Have fun...
__________________________________________________________________________________________________________________________
Code: |
OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Test Program,-1,0,300,70
rem -- Use no leading zeros, and no "$" (CDCDCD is prolly max) --
rem -- Black = 000000, Blue = FF0000, Red = 0000FF, DkGreen = 006600 --
%%startcolor = FF0000
rem -- Get RGB increments needed to fade color --
%%inc1 = "0"@div(@diff($FF,$@substr(%%startcolor,1,2)),50)
%%inc2 = "0"@div(@diff($FF,$@substr(%%startcolor,3,4)),50)
%%inc3 = "0"@div(@diff($FF,$@substr(%%startcolor,5,6)),50)
rem -- 100 colors - adjust %%pbx, %%pby, %%pbw, %%pbh --
rem -- %%pbw is width of color slice (total width is approx 100 x %%pbw) --
%%pbx = 50
%%pby = 40
%%pbw = 2
%%pbh = 20
DIALOG ADD,GROUP,PG1,%%pby,%%pbx,@sum(@prod(%%pbw,100),2),@sum(%%pbh,2)
%%color = $00%%startcolor
%x = 1
%%x2 = @succ(%%pbx)
%%pby = @succ(%%pby)
REPEAT
DIALOG ADD,STYLE,Style%x,,,,%%color
DIALOG ADD,TEXT,Slice%x,%%pby,%%x2,%%pbw,%%pbh,,,Style%x
DIALOG HIDE,Slice%x
if @equal(@mod(%x, 2), 0)
%%color = @sum(%%color, $00%%inc1%%inc2%%inc3)
end
%%x2 = @sum(%%x2, %%pbw)
%x = @succ(%x)
UNTIL @greater(%x, 100)
DIALOG ADD,TEXT,T1,8,5,,,"Percentage"
DIALOG ADD,EDIT,E1,5,65,30,20,"100"
DIALOG ADD,BUTTON,Show,5,100,50,20
DIALOG ADD,BUTTON,Clear,5,155,50,20
DIALOG SHOW
:EVLOOP
WAIT EVENT
goto @event()
:ShowBUTTON
%%percent = @dlgtext(E1)
GOSUB ShowProgress
goto EVLOOP
:ClearBUTTON
GOSUB ClearProgress
goto EVLOOP
:CLOSE
EXIT
rem ------------ GOSUB ------------
:ShowProgress
rem -- Auto clear for multiple calls --
GOSUB ClearProgress
if @not(%%percent)@greater(1,%%percent)
exit
end
%x = 1
REPEAT
DIALOG SHOW, Slice%x
%x = @succ(%x)
UNTIL @greater(%x, 100)@greater(%x, %%percent)
exit
:ClearProgress
rem -- Hide in reverse --
%x = 100
REPEAT
DIALOG HIDE,Slice%x
%x = @pred(%x)
UNTIL @greater(1, %x)
exit
|
Cheers, Mac _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
|
|