Hello Fellow Programmer... :)
> Would anyone happen to have the source for a GOOD lightbar routine
> lying around that they could post..?? Every routine I have seen
> either doesn't work at all or has at least a few serious bugs.
You should always have a go yourself before asking questions but generally your the best person for the job because
you know what you want...
I have had success by having arrays of strings, 2 of them... one for when
the thing is just being displayed, and one for when it is highlighted, and
also a position variable.
Basically you have a loop Where you refresh only the last one, so it is a
good idea to have two position variables..
Procedure Lightbar;
Var Position : Byte ;
Other : Byte ; {just temporary, ie for misc stuff}
Input : Char ; {So You Know What To Do!}
LoopDone : Boolean;
Const
Choices : Array[1..4] of String[20] = ('Choice 1',
'Choice 2',
'Choice 3',
'Choice 4');
Begin
Textcolor(15); {White, Any colour you want really}
For Other := 1 to 4 Do
Begin
Gotoxy(Xoffs, Yoffs + Other); {x,y+choice num, for separate lines}
Write(Choices [ Other ] );
End;
Position := 1; {must be assigned to start, as with most variables}
LoopDone := False; {must be '' '' ''' ''''' }
Repeat
Gotoxy(Xoffs,Yoffs+Position);
Textcolor(4); {Change the Color, Could Just Change Background }
Write( Choices [ Position ] );
Input = Readkey; {Could Be other Procedure if you like, whatever}
Case Input Of
UpArrow : Begin
Gotoxy(Xoffs,Yoffs+position);
Textcolor(15); {back to normal colour}
If Position = 1 Then Position := 4 else Dec( Position );
{Change Position Variable, Displayed On Repeat}
End;
DownArrow : Begin
Gotoxy(Xoffs,Yoffs+position);
Textcolor(15); {back to normal}
If Position = 4 Then Position := 1 else Inc( Position );
End;
Enter{#13} : Begin
Case Position Of 1:Pos1Proc;
2:Pos2Proc;
3:Pos3Proc;
4:{Generally Quit}LoopDone := True;
End;
End;
Escape{#27} : LoopDone := True;
End;
Until LoopDone;
CallAnyOtherProcs;
End;
That Is How I Did Mine, And They Haven't Buggered Up Yet... :)
Cya.
Robert Bilton.
--- FMail/386 1.02
* Origin: Power BBS - +61-2-858-4114 - Files/Games/Mail (3:711/953)
SEEN-BY: 633/267 270
@PATH: 711/953 410 808 50/99 635/544 727 633/267
|