{ coded by skaboy some time in 1997
}
unit PullBar;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
interface
uses gentypes,subs1,subs2,gensubs;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
const
maxBars = 50;
type
pullDataRec = record
onStr : array[1..maxBars] of string[80];
offStr : array[1..maxBars] of string[80];
x : array[1..maxBars] of 1..80;
y : array[1..maxBars] of 1..25;
return : array[1..maxBars] of sStr;
upKey : byte;
downKey : byte;
rightKey : byte;
leftKey : byte;
total : byte;
end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
Function doPullBar(pullData : pullDataRec) : string;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
implementation
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
function doPullBar(pullData : pullDataRec) : string;
var
current : byte;
last : byte;
done : boolean;
procedure showBar;
begin
goXY(pullData.x[last],pullData.y[last]);
subs2.multiColor(pullData.offStr[last]);
goXY(pullData.x[current],pullData.y[current]);
subs2.multiColor(pullData.onstr[current]);
end;
var
inKey : char;
begin
current := 1;
last := 1;
done := false;
showBar;
repeat
inkey := arrowKey(true);
case inkey of
^A : begin
last := current;
if (current<>1) then dec(current,pullData.upKey) else
current := pullData.total;
showBar;
end;
^B : begin
last := current;
if (current<>pullData.total) then inc(current,pullData.downKey) else
current := 1;
showBar;
end;
^C : begin
last := current;
if (current<>pullData.total) then inc(current,pullData.rightKey) else
current := 1;
showBar;
end;
^D : begin
last := current;
if (current<>1) then dec(current,pullData.leftKey) else
current := pullData.total;
showBar;
end;
^M : begin
doPullBar := pullData.return[current];
done := true;
end;
end;
until (done=true) or (hungupOn=true);
end;
{:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::}
begin end.