unit pullbar;
interface
const
  maxchoices=30;
type
PULLD=RECORD
    CURRENTCHOICE:INTEGER;
    MAXC:INTEGER;
    off:ARRAY[1..MAXCHOICES] OF STRING[80];
    on:ARRAY[1..MAXCHOICES] OF STRING[80];
    X:ARRAY[1..MAXCHOICES] OF 1..80;
    Y:ARRAY[1..MAXCHOICES] OF 1..25;
    END;

FUNCTION PULLMENU(var pm:pulld):INTEGER;
implementation
uses dos,crt,fx;

FUNCTION PULLMENU(var pm:pulld):INTEGER;
    VAR X:0..31;
    CINPUT:CHAR;
    C:CHAR;

BEGIN
FOR X:=1 TO pm.MAXC DO BEGIN
GOTOXY(pm.X[X],pm.Y[X]);
PRINT(pm.off[X]);
END;
GOTOXY(pm.X[pm.CURRENTCHOICE],pm.Y[pm.CURRENTCHOICE]);
PRINT(pm.on[pm.CURRENTCHOICE]);
REPEAT
    IF KEYPRESSED THEN C:=READKEY;
    if c=#0 then begin
    c:=readkey;
IF ORD(C) IN [72,75] THEN BEGIN
    GOTOXY(pm.X[pm.CURRENTCHOICE],pm.Y[pm.CURRENTCHOICE]);
    PRINT(pm.off[pm.CURRENTCHOICE]);
    DEC(pm.CURRENTCHOICE);
    IF pm.CURRENTCHOICE=0 THEN pm.CURRENTCHOICE:=pm.MAXC;
    GOTOXY(pm.X[pm.CURRENTCHOICE],pm.Y[pm.CURRENTCHOICE]);
    PRINT(pm.on[pm.CURRENTCHOICE]);
    END ELSE
IF ORD(C) IN [77,80] THEN BEGIN
    GOTOXY(pm.X[pm.CURRENTCHOICE],pm.Y[pm.CURRENTCHOICE]);
    PRINT(pm.off[pm.CURRENTCHOICE]);
    INC(pm.CURRENTCHOICE);
    IF pm.CURRENTCHOICE=pm.MAXC+1 THEN pm.CURRENTCHOICE:=1;
    GOTOXY(pm.X[pm.CURRENTCHOICE],pm.Y[pm.CURRENTCHOICE]);
    PRINT(pm.on[pm.CURRENTCHOICE]);
    END;
end;
UNTIL ORD(C) IN [13];
PULLMENU:=pm.CURRENTCHOICE;
END;

begin
end.