home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / cufs.zip / HRZMENU.PAS < prev    next >
Pascal/Delphi Source File  |  1980-01-01  |  2KB  |  129 lines

  1. {*******************************}
  2. {*   Horizontal Menu Selection *}
  3.  
  4.  
  5.  
  6. Var horzloc : integer;
  7.     ky1,ky2 : char;
  8.     escape : boolean;
  9.     startflag : boolean;
  10.  
  11.  
  12. Procedure Horizontal_Menu;
  13. var xx : integer;
  14. begin
  15.  clrscr;
  16.  horzloc := 1; startflag := true;
  17.  TextColor(0); TextBackGround(15);
  18.  gotoxy(1,1); write('Add Records');
  19.  TextColor(15); TextBackGround(0);
  20.  gotoxy(21,1); write('Update Records');
  21.  gotoxy(41,1); write('Print Report'); gotoxy(61,1); write('Exit Program');
  22.  gotoxy(1,2);
  23.   for xx := 1 to 79 do
  24.    write(#205);
  25.  
  26. end;   {** procedure **}
  27.  
  28. Procedure Start_at_Left;
  29. begin
  30.  TextColor(15); TextBackGround(0);
  31.  gotoxy(1,1); write('Add Records');
  32. end;
  33.  
  34. Procedure Select_Print;
  35. begin
  36.     case horzloc of
  37.   1 : write('Add Records');
  38.   21 : write('Update Records');
  39.   41 : write('Print Report');
  40.   61 : write('Exit Program');
  41.    end;
  42.  
  43.   startflag := false;
  44. end;
  45.  
  46. Procedure Set_Highlight;
  47. begin
  48.  gotoxy(horzloc,1);
  49.  TextColor(0); TextBackGround(15);
  50.  Select_Print;
  51. end;
  52.  
  53. Procedure Reset_Highlight;
  54. begin
  55.  TextColor(15); TextBackGround(0);
  56.  gotoxy(horzloc,1);
  57.  Select_Print;
  58. end;
  59.  
  60. Procedure Move_Right;
  61. begin
  62.  if startflag = false then Reset_Highlight
  63.   else
  64.  Start_at_Left;
  65.  horzloc := horzloc + 20;
  66.  if horzloc > 61 then horzloc := 1;
  67.  Set_Highlight;
  68. end;
  69.  
  70. Procedure Move_Left;
  71. begin
  72.  if startflag = false then Reset_Highlight
  73.   else
  74.   Start_at_Left;
  75.  horzloc := horzloc - 20;
  76.  if horzloc < 1 then horzloc := 1;
  77.  Set_Highlight;
  78. end;
  79.  
  80. Procedure Select_by_Letter;
  81. begin
  82.  
  83. if startflag = false then Reset_Highlight
  84.  else
  85. Start_at_Left;
  86.  case ky1 of
  87.   'A','a' : horzloc := 1;
  88.   'U','u' : horzloc := 21;
  89.   'P','p' : horzloc := 41;
  90.   'E','e' : horzloc := 61;
  91.  end;
  92.  
  93. Set_Highlight;
  94. end; {** procedure **}
  95.  
  96. Procedure Branch_To_Selection;
  97. begin
  98.  TextBackground(0); TextColor(15);
  99.  clrscr;
  100.   case horzloc of
  101.    1 : writeln('Add Records':40);
  102.    21 : writeln('Update Records':40);
  103.    41 : writeln('Print Report':40);
  104.   end;
  105.   delay(2000);
  106.   Horizontal_Menu;
  107. end; {** procedure **}
  108.  
  109. Procedure Read_Arrow_Keys;
  110. begin
  111.  repeat until keypressed;
  112.  Read(Kbd,ky1);
  113.  if ky1 = #13 then Branch_To_Selection;
  114.  if (ky1 = #27) and keypressed then
  115.    begin
  116.     Read(Kbd,ky2);
  117.     if ky2 = #77 then Move_Right;
  118.     if ky2 = #75 then Move_Left;
  119.    end
  120.   else Select_by_Letter;
  121. end;
  122.  
  123.  
  124. begin
  125.  Horizontal_Menu;
  126.  repeat
  127.  Read_Arrow_Keys;
  128.  until horzloc = 61;
  129. end.