Category : Files from Magazines
Archive   : 88FEB-CL.ZIP
Filename : MENUDEMO.PAS
Copyright (c) 1987 Kevin Shook
This program is hereby released to the public domain }
program menudemo;
type
move = (up,down,stop); { possible movements }
var
ch : char; { read from keyboard }
direction : move; { direcion of bar }
screenmenu : array[1..5] of string[10]; { menu choices }
screenpointer : 0..6; { points to item in array }
const
offset = 35 ;
escape = #27;
procedure moveit; { moves menu bar }
begin
TextColor(15);
TextBackground(0); { rewrites previous }
GotoXY(offset,10+(screenpointer-1)*2); { menu choice in ordinary }
write(screenmenu[screenpointer]); { text }
if (direction = up) then { move pointer to new }
begin { menu choice }
screenpointer := screenpointer-1;
if (screenpointer < 1) then screenpointer :=5;
end
else
begin
screenpointer := screenpointer +1;
if screenpointer > 5 then screenpointer := 1;
end;
Textcolor(0);
TextBackground(15);
GotoXY(offset,10+(screenpointer-1)*2); { write new menu choice }
write(screenmenu[screenpointer]); { in highlighted text }
end;{of procedure}
begin
ScreenMenu[1] := 'Choice #1'; { menu alternatives }
ScreenMenu[2] := 'Choice #2'; { ... call 'em what }
ScreenMenu[3] := 'Choice #3'; { you like .... }
ScreenMenu[4] := 'Choice #4';
ScreenMenu[5] := 'Choice #5';
clrscr; { draws the screen }
gotoxy(32,1);
write('Menu Demonstration');
for ScreenPointer := 1 to 5 do
begin
GotoXY(offset,10+(ScreenPointer-1)*2); { puts the choices }
write(ScreenMenu[ScreenPointer]); { on the screen }
end;
screenpointer := 2; { initializes }
direction := up; { req'd variables }
moveit; { draw first bar }
repeat
if keypressed then
begin
read(kbd,ch);
if ch = #13 then direction := stop; { RETURN key pressed }
if(ch = escape) and (keypressed) then
begin
read(kbd,ch);
if ch = #72 then
begin
direction := up;
moveit;
end
else if ch = #80 then
begin
direction := down;
moveit;
end;
end
end;
until (direction = stop);
{ this program just quits when the RETURN key is pressed. In a "real"
program, this would be a procedure which returns the value of the position
of the bar (which is stored in the variable ScreenPointer) }
end. { of program }
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/