| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Status Bar |
Hi Brad,
And thus Brad let it be known to Peter:
PL>> I did something like this for a sorting routine I wrote, it
PL>> was quite easy and gave the user something to look at while
PL>> the computer did the boring stuff.
BB> I would like to see how you drew your status bar please.
Hmm I just had a look at the code. The problem is that it is all tied into
one procedure that is doing the sorting on a database. It's not a very
good example to use.
I prolly should have written the drawing of the status bar as a seperate
procedure to make it easier to use in other procedures.
Anyway it's not that hard to do. If you can work out percentages the
hardest part is covered. All you have to do it draw the symbols you want
on screen.
I'll grab the bit of code that I have, and try reworking it to make some sence.
*-=-=-=-=[ Begin: stbar.pas ]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Write('Sorting Parts by part number now.');
Col:= 5;
Row:= 20;
gotoxy(Col,Row);
TextColor(1);
Write('0% ');
TextColor(8);
for BlkCnt:= 1 to LineLen do { <- LineLen is a const. holding the
value for the length of the line }
Write (Light); { Light is an ASCII char held as a const. }
TextColor(9);
Write(' 100%');
{-----
for Cnt:= 1 to SortArSz-1 do
begin{for Cnt}
PntOfSmlst:= Cnt;
for I := Cnt to SortArSz do
if SortRec[I].PartNumber < SortRec[PntofSmlst].PartNumber then
PntofSmlst:= I;
Temp:= SortRec[PntofSmlst];
SortRec[PntofSmlst]:= SortRec[Cnt];
SortRec[Cnt]:= Temp;
------}
{ The above is not of any signifcance as it relates to the sorting of the
database. I'll leave it in so you can see what variables are being worked
on.}
{Work out %age of completed job}
Comp:= (Cnt / SortArSz)*100;
CompInt:= Round(Comp);
{if Cnt = the max in the for loop then we need to show 100% complete
in the calculations by fudging the figures here}
if Cnt = SortArSz-1 then
CompInt:= 100;
{Work out how much to write on bar}
DrawR:= (LineLen / 100) * CompInt;
DrawI:= round(DrawR);
Col:= 8;
Row:= 20;
gotoxy(Col,Row);
Textcolor(15);
for BlkCnt:= 1 to DrawI do
Write(Block);
delay(300);
end; {for Cnt loop}
Row:= Row+3;
TextColor(White);
gotoxy(Col,Row);
Write('Done!');
inc (Row);
gotoxy(Col,Row);
TextColor(7);
Write('Hit [Enter] to continue.');
ReadLn(Enter);
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[ End: stbar.pas ]*
I'm not sure if you will get anything out if this as you will have to
follow the varaibles.
The pseudo code would look a little like this:
draw status bar in dark colour
repeat
calculate %age of task completed
calculate %age of status bar needing to be redrawn
redraw status bar in light colour
until task 100% complete
That is pretty much one reason I lumped the status bar in the database
sorting procedure, altho it wouldn't have been too hard to make it a
seperate procedure as I stated earlier.
Cya,
Pete
---
* Origin: Wagga Wagga!? Where the hell next? (3:635/506.4)SEEN-BY: 633/267 270 @PATH: 635/506 503 50/99 635/728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.