home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUILLET
/
ROLLCURS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
71 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 157 of 158
From : Herb Brown 1:396/15.6 19 Jul 93 01:52
To : Paul Staton
Subj : source code
────────────────────────────────────────────────────────────────────────────────
In a msg on <Jul 18 17:58>, Paul Staton of 1:124/5147 writes:
PS> Does anyone have some source to make a scrolling completion bar
PS> such as the ones found in most install programs for store
PS> bought programs. I will be read the total conferance areas
Here is one I whipped up for rolling the cursor and shows the bar of
completion..
(tested and YES, people it needs optimization!!!!!)
( And I know, I know, my style SUCKS!! ;-)}
program RollCurs;
{produces a "rolling cursor" and shows various ways of producing
a report of "percent of completion"}
uses dos, Opcrt; { Opro used to turn cursor off and on }
const Work : array[1..4] of char =
('\','|','/','-'); { Rolling cursor characters }
x : integer = 1;
MaxLoop : Integer = 10000; { Just to compute something ...}
var i :integer;
Bar : string;
p10,p20,p30,p40,p50,p60,p70,p80,p90,p100 : Integer;
begin
bar:='';
HiddenCursor;
clrscr;
for i:=1 to MaxLoop do
begin
x:=(x mod 4)+1; { Index new element in array }
write('running...',work[x],' ',round((i / MaxLoop)*100),' ','%',#13);
delay(20);
end;
writeln;
writeln(' [1234567890] Percentage Completed - In multiples of 10');
p10:= round((10*(1/100))*maxLoop); { get the percents of the value }
p20:= round((20*(1/100))*maxLoop);
p30:= round((30*(1/100))*maxLoop);
p40:= round((40*(1/100))*maxLoop);
p50:= round((50*(1/100))*maxLoop);
p60:= round((60*(1/100))*maxLoop);
p70:= round((70*(1/100))*maxLoop);
p80:= round((80*(1/100))*maxLoop);
p90:= round((90*(1/100))*maxLoop);
p100:=round((100*(1/100))*MaxLoop);
for i:=1 to MaxLoop do
begin
if (i=p10)
or (i=p20)
or (i=p30)
or (i=p40)
or (i=p50)
or (i=p60)
or (i=p70)
or (i=p80)
or (i=p90)
or (i=p100) then bar:=bar+#176;
x:=(x mod 4)+1; { Index new element in array }
write('running...',work[x],' ',Bar,#13);
delay(20);
end;
NormalCursor;
end.