home *** CD-ROM | disk | FTP | other *** search
- program Draw_Field;
- const
- Menu : array[1..7] of string[28] = ('╒══════════════════════════╕',
- '│ <<< M E N U >>> │',
- '│ │',
- '│ --- CHOICE # 1 --- │',
- '│ --- CHOICE # 2 --- │',
- '│ --- CHOICE # 3 --- │',
- '╘══════════════════════════╛' );
-
- var
- Key : char;
- KeyVal : integer;
- Bar : integer;
- {----------------------------------------------------------------------------}
- { DRAWFIELD: }
- { ROW, COLUMN = start position of field }
- { SIZE = # of screen positions to set }
- { ATTRIB = Attribute of field to draw }
- { Note: This does NOT change the characters appearing in the "field" -- just }
- { the COLOR of the BACKGROUND and FOREGROUND! }
- {----------------------------------------------------------------------------}
- procedure Draw_Field(Row,Column,Size,Attrib : integer);
- external '\turbo\tasm\DRWFIELD.BIN';
-
- function GetKey : integer;
- var
- Key : array[1..2] of char;
- KeyVal : integer absolute Key;
- begin
- KeyVal := 0;
- if Keypressed then
- begin
- read(kbd,Key[1]);
- if keypressed then
- begin
- read(kbd,key[1]);
- Key[2] := #1;
- end
- end;
- GetKey := KeyVal;
- end;
-
- procedure Display_Menu;
- var
- Line : integer;
- begin
- ClrScr;
- writeln(' Press ',#24,' to move the highlighted bar upward, or press');
- writeln(' ',#25,' to move the highlighted bar downward. To "select"');
- writeln(' an "option", press the [ENTER] key. Press [ESC] to end ');
- writeln(' this demo.');
- for Line := 1 to 7 do
- begin
- gotoxy(30,Line+9);
- write(Menu[Line]);
- end;
- end;
-
- begin
- Display_Menu;
- Bar := 1;
- gotoxy(1,25);
- repeat
- Draw_Field(12+Bar,31,26,$70);
- repeat
- KeyVal := GetKey;
- until KeyVal > 0;
- case KeyVal of
- 336: begin {Down Arrow}
- Draw_Field(12+Bar,31,26,$0F);
- Bar := succ(Bar);
- if Bar = 4 then
- Bar := 1;
- end;
- 328: begin {Up Arrow}
- Draw_Field(12+Bar,31,26,$0F);
- Bar := Pred(Bar);
- if Bar = 0 then
- Bar := 3;
- end;
- 13: begin
- gotoxy(30,25);
- write('Option #',Bar,' chosen!');
- end;
- 27: begin
- gotoxy(30,25);
- write('*** Program concluded! ***');
- end;
- end;
- until KeyVal = 27;
- end.