home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
554
/
JUILLET
/
COMPBAR.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
58 lines
{─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
Msg : 383 of 447
From : Raphael Vanney 2:320/7.0 22 Jul 93 20:56
To : Paul Staton
Subj : Source code
────────────────────────────────────────────────────────────────────────────────
Hi !
PS>Does anyone have some source to make a scrolling completion bar such as
PS> the ones found in most install programs for store bought programs.
PS> I will be read the total conferance areas and then make the bar.
PS> The total, whatever it is needs to fit into a fixed number of spaces,
PS> ie, 80 conferences, bar length say 30.
PS> 0% 50% 100%
------------------------------------------------------------ Cut here}
Uses Crt ;
Procedure DrawBar( x, y : Integer ;
Current,
Total : LongInt ;
Width : Integer) ;
{ x, y : Coordinates where to display the bar }
{ Current : Current number of operations completed }
{ Total : Total # to complete }
{ Width : Maximum width of the bar }
Var Len : Integer ;
i : Integer ;
Begin
Len:=Current*Width Div Total ;
{ Set up first line }
GoToXY(x, y) ; Write('0%') ;
GoToXY(x+Width Div 2-1, y) ; Write('50%') ;
GoToXY(x+Width-4, y) ; Write('100%') ;
{ Draw bar }
GoToXY(x, y+1) ;
For i:=1 To Len Do Write(#176) ;
End ;
Var i : Integer ;
Begin
ClrScr ;
For i:=1 To 80 Do
Begin
DrawBar(5, 5, i, 80, 30) ;
Delay(100) ;
End ;
End.
------------------------------------------------------------ Cut here
Of course, it lacks some enhancements : for instance, you could use
characters #219, #221 and #222. The procedure should not redraw the
percentage line each time, nor should it redraw the bat if the length
has not changed between two calls...