home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP5MENU.ZIP / MENUCODE.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-22  |  43.4 KB  |  1,262 lines

  1. {
  2. Copyright (c) 1988 BittWare Computing, ALL RIGHTS RESERVED
  3. }
  4. unit menucode;
  5. {$v-}
  6. interface 
  7. uses 
  8.         menuvars,
  9.         crt,
  10.         beepkey4,
  11.         dos;
  12. const
  13. {error constants}
  14.      InputOK        = 0;
  15.      InputError     = 1;
  16.      NoInput        = 2;
  17.      NoOutput       = 3;
  18.  
  19. var
  20.         DirList         :PickListPtr;
  21.         DirScreen       :HalfScreenPtr;
  22.         ConfirmMenu     :MenuPtr;
  23.         ConfirmScreen   :ConfirmScreenPtr;
  24.  
  25. procedure InitMenuCode;
  26. function Confirmed(InitVal,Auto: boolean):boolean;
  27. procedure ConvertString(var InpStr:LineStrg; MaxCh,VarCode:byte;
  28.                       var RtnCode:byte; VarAddr:pointer);
  29. procedure InputString(InpStr:LineStrg; MaxCh:byte;
  30.                       var OutStr:LineStrg; var RtnCode:byte);
  31. procedure UpdateMenu(MenuName:MenuPtr);
  32. procedure WaitEscape;
  33. procedure sv_screen(x1,y1,x2,y2:byte;screen_dat:HalfScreenPtr);
  34. procedure restore_screen(x1,y1,x2,y2:byte;screen_dat:HalfScreenPtr);
  35. procedure sv_wh_screen(screen_dat:screenptr);
  36. procedure restore_wh_screen(screen_dat:screenptr);
  37. procedure border(x1,y1,x2,y2,fg,bg:byte);
  38.  
  39. procedure HideCurs;
  40. procedure UnHideCurs;
  41. procedure ErrorMessage;
  42. procedure CloseIOWindow(MessageList:MessagePtr);
  43. procedure OpenIOWindow(MessageList:MessagePtr);
  44. function pass_keycode(var ch:char):byte;
  45. procedure OpenPullDownMenu(MenuList:MenuPtr);
  46. function PullDownMenu(MenuList:MenuPtr):byte;
  47. procedure ClosePullDownMenu(MenuList:MenuPtr);
  48. function PickHeader(y:byte;HdrList:HdrPtr):byte;
  49. function PickList(InputList:PickListPtr):byte;
  50. procedure OpenPickList(InputList:PickListPtr);
  51. procedure ClosePickList(InputList:PickListPtr);
  52. procedure GetFile(var RtnFileName:FileString;FileMask:FileString;path:linestrg;var RtnCode:byte);
  53. function Real2Str(InpReal:real;w,d:byte):string;
  54. Function exist(FileName:linestrg):boolean;
  55. Function LoadHelpFile(var HelpFilePath:LineStrg;HelpFileName:FileString):boolean;
  56. procedure OpenHeader(y:byte;HdrList:HdrPtr);
  57.  
  58. implementation
  59. var
  60.         ch              :char;
  61.         TimeQuit        :boolean;
  62.         PickListMax          :byte;
  63.         Xpos,Ypos            :byte;
  64.         MaxRows              :byte;
  65.         y                    :byte;
  66.         PickListSelX         :byte;
  67.         PickListSelY         :byte;
  68.         Keycode          :byte;
  69.         PDrtn            :byte;
  70.  
  71. function Real2Str(InpReal:real;w,d:byte):string;
  72. const
  73.      HiReal = 1e5;
  74.      LoReal = 1e-3;
  75. var
  76.      StringVar  :string[20];
  77. begin
  78.      if (abs(InpReal) >= 1e5) then str(InpReal:w:-1,StringVar);
  79.      if ((abs(InpReal) < 1e-2) and (InpReal <> 0)) 
  80.           then str(InpReal:w:-1,StringVar);
  81.      if ((abs(InpReal) < 1e5) and (abs(InpReal) >= 1e-2) or (InpReal = 0)) 
  82.           then str(InpReal:w:d,StringVar);
  83.      while(stringVar[1] = ' ') do 
  84.            delete(StringVar,1,1);
  85.      Real2Str := StringVar;
  86. end;
  87.  
  88. procedure HideCurs;
  89. begin
  90.      regs.ah := 1;
  91.      regs.ch := $20;
  92.      regs.cl := 0;
  93.      intr($10,regs);
  94. end;
  95.  
  96. procedure UnHideCurs;
  97. begin
  98.      regs.ah := 1;
  99.      regs.ch := CursStart;
  100.      regs.cl := CursEnd;
  101.      intr($10,regs);
  102. end;
  103.  
  104. procedure PDSel(MenuList:MenuPtr;MenuSel:byte);forward;
  105.  
  106. procedure ErrorMessage;
  107. var
  108.      ta   :byte;
  109. begin
  110.      ta := TextAttr;
  111.      Bad_Beep;
  112.      OpenIOWindow(ErrorList);
  113.      writeln('Error # ',ErrorNum);
  114.      writeln(ErrorMessStr[ErrorNum]);
  115.      writeln('Hit <Esc> to continue...');
  116.      InEsc;
  117.      CloseIOWindow(ErrorList);
  118.      ErrorNum := NoError;
  119.      TextAttr := ta;
  120. end;
  121.  
  122. procedure SetTxtFg(col:byte);
  123. begin
  124.         TxtFg := col;
  125.         TextColor(col);
  126. end;
  127.  
  128. procedure SetTxtBg(col:byte);
  129. begin
  130.         TxtBg := col;
  131.         TextBackground(col);
  132. end;
  133.  
  134. procedure sv_screen(x1,y1,x2,y2:byte;screen_dat:HalfScreenPtr);
  135. var
  136.         i,j     :byte;
  137.         indx    :integer;
  138. begin
  139.         indx := 0;
  140.         for i := x1 to x2 do
  141.                 for j := y1 to y2 do begin
  142.                         indx := indx + 1;
  143.                         screen_dat^[indx] := screen^[j,i].ch;
  144.                         indx := indx + 1;
  145.                         screen_dat^[indx] := screen^[j,i].at;
  146.                 end;
  147. end;
  148.  
  149. procedure restore_screen(x1,y1,x2,y2:byte;screen_dat:HalfScreenPtr);
  150. var
  151.         i,j     :byte;
  152.         indx    :integer;
  153. begin
  154.         indx := 0;
  155.         for i := x1 to x2 do
  156.                 for j := y1 to y2 do begin
  157.                         indx := indx + 1;
  158.                         screen^[j,i].ch := screen_dat^[indx];
  159.                         indx := indx + 1;
  160.                         screen^[j,i].at := screen_dat^[indx];
  161.                 end;
  162. end;
  163.  
  164. procedure sv_wh_screen(screen_dat:screenptr);
  165. begin
  166.         screen_dat^ := screen^;
  167. end;
  168.  
  169. procedure restore_wh_screen(screen_dat:screenptr);
  170. begin
  171.         screen^ := screen_dat^;
  172. end;
  173.  
  174. procedure border(x1,y1,x2,y2,fg,bg:byte);
  175. var
  176.      i         :integer;
  177. begin
  178.      TextColor(fg);
  179.      TextBackground(bg);
  180.  
  181.      for i := succ(x1) to pred(x2) do begin
  182.          gotoxy(i,y1);
  183.          write(#196);
  184.          gotoxy(i,y2);
  185.          write(#196);
  186.      end;
  187.  
  188.      for i := succ(y1) to pred(y2) do begin
  189.          gotoxy(x1,i);
  190.          write(#179);
  191.          gotoxy(x2,i);
  192.          write(#179);
  193.      end;
  194.  
  195.      gotoxy(x1,y1);
  196.      write(#218);
  197.      gotoxy(x2,y1);
  198.      write(#191);
  199.      gotoxy(x1,y2);
  200.      write(#192);
  201.      gotoxy(x2,y2);
  202.      write(#217);
  203.  
  204. end;
  205.  
  206. procedure OpenIOWindow(MessageList:MessagePtr);
  207. var
  208.         x1,y1,x2,y2,indx,l,x      :byte;
  209.         wx1,wy1,wx2,wy2       :byte;
  210. begin
  211.      if not(auto) then begin
  212.         MessageList^.OldX := wherex;
  213.         MessageList^.OldY := wherey;
  214.         MessageList^.OldWindMin := WindMin;
  215.         MessageList^.OldWindMax := WindMax;
  216.         x1 := MessageList^.x;
  217.         y1 := MessageList^.y;
  218.         x2 := x1 + MessageList^.dX + 1;
  219.         y2 := y1 + MessageList^.dY + 1;
  220.         sv_screen(x1,y1,x2,y2,MessageList^.ScreenBufPtr);
  221.         window(1,1,80,25);
  222.         border(x1,y1,x2,y2,MessageList^.BorderFg,MessageList^.BorderBg);
  223.         l := length(MessageList^.Title);
  224.         if l <> 0 then begin
  225.                 x := round((x2-x1-l)/2) + x1;
  226.                 gotoxy(x,y1);
  227.                 write(MessageList^.Title);
  228.         end;
  229.         window(succ(x1),succ(y1),pred(x2),pred(y2));
  230.         TextBackground(MessageList^.Bg);
  231.         TextColor(MessageList^.Fg);
  232.         clrscr;
  233.      end;
  234. end;
  235.  
  236. procedure CloseIOWindow(MessageList:MessagePtr);
  237. var
  238.         x1,y1,x2,y2,indx,l,x      :byte;
  239.         wx1,wy1,wx2,wy2       :byte;
  240. begin
  241.      if not(auto) then begin
  242.         x1 := MessageList^.x;
  243.         y1 := MessageList^.y;
  244.         x2 := x1 + MessageList^.dX + 1;
  245.         y2 := y1 + MessageList^.dY + 1;
  246.         restore_screen(x1,y1,x2,y2,MessageList^.ScreenBufPtr);
  247.         wx1 := lo(MessageList^.OldWindMin) + 1;
  248.         wy1 := hi(MessageList^.OldWindMin) + 1;
  249.         wx2 := lo(MessageList^.OldWindMax) + 1;
  250.         wy2 := hi(MessageList^.OldWindMax) + 1;
  251.         window(wx1,wy1,wx2,wy2);
  252.         gotoxy(MessageList^.OldX,MessageList^.OldY);
  253.      end;
  254. end;
  255.  
  256. procedure HelpMessage;
  257. var
  258.      indx           :integer;
  259.      pagenum        :byte;
  260.      LastHelpNum    :array[1..MaxHelpPages] of integer;
  261.      InpHelpNum     :integer;
  262.      NoMoreHelp     :boolean;
  263.      ch             :char;
  264.      First          :boolean;
  265.      ta             :byte;
  266. begin
  267.      ta := TextAttr;
  268.      OpenIOWindow(HelpList);
  269.      if HelpFileFound then begin
  270.           if HelpNum > MaxHelps then begin
  271.                ErrorNum := SeekPastHelp;
  272.           end
  273.           else begin
  274.                NoMoreHelp := false;
  275.                InpHelpNum := HelpNum;
  276.                PageNum := 1;
  277.                First := true;
  278.                repeat
  279.                     seek(HelpFile,HelpNum);
  280.                     read(HelpFile,HelpVar);
  281.                     clrscr;
  282.                     for indx := 1 to MaxHelpLines do 
  283.                          writeln(HelpVar.str[indx]);
  284.                     writeln;
  285.                     if ((HelpVar.NextRec = 0) and First) then begin
  286.                             write('<Esc> - Return');
  287.                             NoMoreHelp := true;
  288.                             InEsc;
  289.                     end
  290.                     else begin
  291.                             First := false;
  292.                             write('<N> - next, <B> - back, <Esc> - Return');
  293.                             inkey(['N','B',#27],ch);
  294.                             case ch of
  295.                                  'B'  :begin
  296.                                            if PageNum = 1 then bad_beep
  297.                                            else begin
  298.                                                 HelpNum := LastHelpNum[PageNum];
  299.                                                 dec(PageNum);
  300.                                            end;
  301.                                       end;
  302.                                  'N'  :begin
  303.                                            if HelpVar.NextRec = 0 then bad_beep
  304.                                            else begin
  305.                                                 inc(PageNum);
  306.                                                 LastHelpNum[PageNum] := HelpNum;
  307.                                                 HelpNum := HelpVar.NextRec;
  308.                                            end;
  309.                                       end;
  310.                                  #27  :NoMoreHelp := true;
  311.                             end;
  312.                     end;
  313.                until NoMoreHelp;
  314.                HelpNum := InpHelpNum;
  315.           end;
  316.      end
  317.      else begin
  318.           writeln('Help file was not found upon initialization..');
  319.           writeln('Help number = ',HelpNum);
  320.           writeln;
  321.           write('Hit <Esc> to continue');
  322.           InEsc;
  323.      end;
  324.      CloseIOWindow(HelpList);
  325.      TextAttr := ta;
  326. end;
  327.  
  328. function pass_keycode(var ch:char):byte;
  329. var
  330.         pass_key_int    :byte;
  331.         RtnOk     :boolean;
  332. begin
  333. repeat
  334.         RtnOk := true;
  335.         ch := readkey;
  336.         func_key_bool := false;
  337.         Pass_key_int := 255;
  338.         ch := upcase(ch);
  339.         case ch of
  340.                 #0     :begin
  341.                               func_key_bool := true;
  342.                               ch := readkey;
  343.                               Pass_key_int := func_key;
  344.                               case ch of
  345.                                       lt_arr_asc  :Pass_key_int := lt_arr;
  346.                                       fn_home_asc :Pass_key_int := fn_home;
  347.                                       fn_end_asc  :Pass_key_int := fn_end;
  348.                                       fn_pgdn_asc :Pass_key_int := fn_pgdn;
  349.                                       fn_pgup_asc :Pass_key_int := fn_pgup;
  350.                                       rt_arr_asc  :Pass_key_int := rt_arr;
  351.                                       up_arr_asc  :Pass_key_int := up_arr;
  352.                                       dn_arr_asc  :Pass_key_int := dn_arr;
  353.                                       f1_asc      :Pass_key_int := f1;
  354.                                       f2_asc      :Pass_key_int := f2;
  355.                                       f3_asc      :Pass_key_int := f3;
  356.                                       f4_asc      :Pass_key_int := f4;
  357.                                       f5_asc      :Pass_key_int := f5;
  358.                                       f6_asc      :Pass_key_int := f6;
  359.                                       f7_asc      :Pass_key_int := f7;
  360.                                       f8_asc      :Pass_key_int := f8;
  361.                                       f9_asc      :Pass_key_int := f9;
  362.                                       f10_asc     :Pass_key_int := f10;
  363.                                       ctl_lt_asc  :Pass_key_int := ctl_lt_arr;
  364.                                       ctl_rt_asc  :Pass_key_int := ctl_rt_arr;
  365.                                       ins_asc     :Pass_key_int := InsKey;
  366.                                       del_asc     :Pass_key_int := DelKey;
  367.                               end;
  368.                         end;
  369.                #8       :Pass_key_int := back_spc;
  370.                #13      :Pass_key_int := carr_rtn;
  371.                #27      :Pass_key_int := escape;
  372.                #52      :Pass_key_int := sh_lt_arr;
  373.                #54      :Pass_key_int := sh_rt_arr;
  374.                #43      :Pass_key_int := plus_key;
  375.                #45      :Pass_key_int := minus_key;
  376.         end; {of case}
  377.         if func_key_bool then ch := '*';
  378.         pass_keycode := pass_key_int;
  379.         case pass_key_int of
  380.                 f1      :begin
  381.                               HelpMessage;
  382.                               RtnOk := false;
  383.                         end;
  384.         end;
  385. until RtnOk;        
  386. end;
  387.  
  388. procedure WaitEscape;
  389. var
  390.      t    :byte;
  391.      ch   :char;
  392. begin
  393.      repeat
  394.           t := pass_keycode(ch);
  395.           if t<> escape then bad_beep;
  396.      until t=escape;
  397. end;
  398.  
  399. procedure InputString(InpStr:LineStrg; MaxCh:byte;
  400.                       var OutStr:LineStrg; var RtnCode:byte);
  401. var
  402.         GetKey          :byte;
  403.         Indx            :integer;
  404.         RtnTime,TimeQuit:boolean;
  405.         tx,ty           :integer;
  406.         ch              :char;
  407.         i,los           :byte;
  408. begin
  409.         tx := wherex;
  410.         ty := wherey;
  411.         for indx := 1 to MaxCh do write(' ');
  412.         gotoxy(tx,ty);
  413.         if length(InpStr) >= MaxCh
  414.              then for indx := 1 to MaxCh do write(InpStr[indx])
  415.              else write(InpStr);
  416.         gotoxy(tx,ty);
  417.         TimeQuit := False;
  418.         OutStr := InpStr;
  419.         Indx := 1;
  420.         repeat
  421.                 los := Length(OutStr);
  422.                 GetKey := Pass_Keycode(ch);
  423.                 Case GetKey of
  424.                         Back_Spc        :begin
  425.                                                 if indx > 1 then begin
  426.                                                         dec(indx);
  427.                                                         delete(OutStr,indx,1);
  428.                                                         gotoxy(tx,ty);
  429.                                                         for i := 0 to los do write(' ');
  430.                                                         gotoxy(tx,ty);
  431.                                                         write(OutStr);
  432.                                                 end
  433.                                                 else bad_beep;
  434.                                         end;
  435.                         Carr_Rtn        :begin
  436.                                                 RtnCode := InputOK;
  437.                                                 TimeQuit := True;
  438.                                         end;
  439.                         Rt_Arr          :begin
  440.                                                 if indx <= los then begin
  441.                                                      inc(indx);
  442.                                                 end
  443.                                                 else bad_beep;
  444.                                         end;
  445.                         Lt_Arr          :begin
  446.                                                 if indx > 1 then begin
  447.                                                      dec(indx);
  448.                                                 end
  449.                                                 else bad_beep;
  450.                                         end;
  451.                         Fn_End          :begin
  452.                                                 if los < MaxCh then begin
  453.                                                       indx := los + 1;
  454.                                                 end
  455.                                                 else indx := los;
  456.                                         end;
  457.                         Fn_Home         :begin
  458.                                                 indx := 1;
  459.                                         end;
  460.                         InsKey          :begin
  461.                                                 if ((los < MaxCh) and (indx <= los)) then begin
  462.                                                         Insert(' ',OutStr,indx);
  463.                                                         gotoxy(tx,ty);
  464.                                                         for i := 0 to los do write(' ');
  465.                                                         gotoxy(tx,ty);
  466.                                                         write(OutStr);
  467.                                                 end
  468.                                                 else bad_beep;
  469.                                         end;
  470.                         DelKey          :begin
  471.                                                 if los > 0 then begin
  472.                                                         Delete(OutStr,indx,1);
  473.                                                         gotoxy(tx,ty);
  474.                                                         for i := 0 to los do write(' ');
  475.                                                         gotoxy(tx,ty);
  476.                                                         write(OutStr);
  477.                                                 end
  478.                                                 else bad_beep;
  479.                                         end;
  480.                         Escape          :begin
  481.                                                 RtnCode := NoInput;
  482.                                                 OutStr := '';
  483.                                                 TimeQuit := True;
  484.                                         end;
  485.                         else if ((indx <= MaxCh) and (not (Func_Key_Bool))) then begin
  486.                                 if indx=1 then begin
  487.                                         gotoxy(tx,ty);
  488.                                         for i := 1 to MaxCh do
  489.                                                 write(' ');
  490.                                         gotoxy(tx,ty);
  491.                                         OutStr := ch;
  492.                                 end
  493.                                 else if indx > Length(OutStr) then begin
  494.                                         OutStr := OutStr + ch;
  495.                                      end
  496.                                      else OutStr[indx] := ch;
  497.                                 inc(indx);
  498.                                 write(ch);
  499.                         end
  500.                         else bad_beep;
  501.                 end; {of case get_key}
  502.                 if not(TimeQuit) then begin
  503.                         gotoxy(tx+indx-1,ty);
  504.                 end;
  505.         until TimeQuit;
  506. end;
  507.  
  508. procedure ConvertString(var InpStr:LineStrg; MaxCh,VarCode:byte;
  509.                       var RtnCode:byte; VarAddr:pointer);
  510. const
  511.      MaximumInt = 32767;
  512.      MinimumInt = -32768;
  513. var
  514.      x         :integer;
  515.      li        :longint;
  516.      r         :real;
  517.      i         :integer;
  518.      ts        :linestrg;
  519.  
  520. begin
  521.           case VarCode of
  522.                LongIntCode    :val(InpStr,li,x);
  523.                RealCode       :begin
  524.                                     val(InpStr,r,x);
  525.                                     if x <> 0 then begin
  526.                                         insert('0',InpStr,1);
  527.                                         val(InpStr,r,x);
  528.                                     end;
  529.                               end;
  530.                IntCode        :begin
  531.                                     x := 0;
  532.                                     val(InpStr,li,x);
  533.                                     if li > MaximumInt then x := 1;
  534.                                     if li < MinimumInt then x := 1;
  535.                                     if x=0 then i := li;
  536.                               end;
  537.                StringCode     :x := 0;
  538.           end;
  539.           if x <> 0 then begin
  540.                RtnCode := InputError;
  541.           end
  542.           else begin
  543.                if VarAddr <> nil then begin
  544.                     RtnCode:= InputOK;
  545.                     case VarCode of
  546.                          LongIntCode    :begin
  547.                                              longint(VarAddr^) := li;
  548.                                              str(li,InpStr);
  549.                                         end;
  550.                          RealCode       :begin
  551.                                              real(VarAddr^) := r;
  552.                                              InpStr := Real2Str(r,MaxCh,2);
  553.                                         end;
  554.                          IntCode        :begin
  555.                                              integer(VarAddr^) := i;
  556.                                              str(i,InpStr);
  557.                                         end;
  558.                          StringCode     :begin
  559.                                              linestrg(VarAddr^) := InpStr;
  560.                                         end;
  561.                     end;
  562.                end
  563.                else RtnCode := NoOutput;
  564.           end;
  565. end;
  566.  
  567. procedure PDSel(MenuList:MenuPtr;MenuSel:byte);
  568. begin
  569.         textcolor(MenuList^.SelFg);
  570.         textbackground(MenuList^.SelBg);
  571.         gotoxy(1,MenuSel);
  572.         write(MenuList^.str[MenuSel]:MenuList^.TxtLen);
  573.         gotoxy(1,MenuSel);
  574. end;
  575.  
  576. procedure PDUnSel(MenuList:MenuPtr;MenuSel:byte);
  577. var
  578.      FC   :byte;
  579.      i2   :byte;
  580.      indx :byte;
  581.      ch   :char;
  582. begin
  583.      textbackground(MenuList^.NoSelBg);
  584.      ch := MenuList^.SelPattern[MenuSel];
  585.      if ch = '*' then begin
  586.          TextColor(MenuList^.Fg);
  587.          gotoxy(1,MenuSel);
  588.          write(MenuList^.str[MenuSel]:MenuList^.TxtLen);
  589.          ch := MenuList^.PickKey[MenuSel];
  590.          ch := upcase(ch);
  591.          i2 := 0;
  592.          indx := 0;
  593.          while ((i2=0) and (indx < (length(MenuList^.str[MenuSel])))) do begin
  594.                inc(indx);
  595.                if ch = upcase(MenuList^.str[MenuSel][indx])
  596.                     then i2 := indx;
  597.          end;
  598.          if (i2 <> 0) then begin
  599.               fc := MenuList^.TxtLen - length(MenuList^.str[MenuSel]) + i2;
  600.               gotoxy(fc,MenuSel);
  601.               textcolor(PickKeyFg);
  602.               write(upcase(MenuList^.str[MenuSel][i2]));
  603.               gotoxy(1,MenuSel);
  604.          end;
  605.      end
  606.      else begin
  607.          TextColor(MenuList^.NoSelFg); 
  608.          gotoxy(1,MenuSel);
  609.          write(MenuList^.str[MenuSel]:MenuList^.TxtLen);
  610.      end;
  611. end;
  612.  
  613. procedure OpenPullDownMenu(MenuList:MenuPtr);
  614. var
  615.         x1,y1,x2,y2,indx,l,x      :byte;
  616.         MenuMax         :byte;
  617.         pch             :char;
  618.         MenuSel         :byte;
  619.         ok              :boolean;
  620.         fc              :byte;
  621. begin
  622.      if not(auto) then begin
  623.         MenuList^.OldWindMin := WindMin;
  624.         MenuList^.OldWindMax := WindMax;
  625.         MenuMax := MenuList^.Max;
  626.         x1 := MenuList^.x;
  627.         y1 := MenuList^.y;
  628.         x2 := x1 + MenuList^.Width + 1;
  629.         y2 := y1 + MenuList^.Max + 1;
  630.         sv_screen(x1,y1,x2,y2,MenuList^.ScreenBufPtr);
  631.         window(1,1,80,25);
  632.         border(x1,y1,x2,y2,MenuList^.BorderFg,MenuList^.BorderBg);
  633.         l := length(MenuList^.Title);
  634.         if l <> 0 then begin
  635.                 x := round((x2-x1-l)/2) + x1;
  636.                 gotoxy(x,y1);
  637.                 write(MenuList^.Title);
  638.         end;
  639.         window(succ(x1),succ(y1),pred(x2),pred(y2));
  640.         TextBackground(MenuList^.VarBg);
  641.         clrscr;
  642.         window(succ(x1),succ(y1),x2,pred(y2));
  643.  
  644.         MenuList^.SelPattern[1] := '*';
  645.         if MenuList^.SelPattern[MenuList^.Sel] <> '*' then
  646.             MenuList^.Sel := 1;
  647.  
  648.         for indx := 1 to MenuList^.Max do PDunsel(MenuList,indx);
  649.  
  650.         MenuSel := MenuList^.Sel;
  651.         PDSel(MenuList,MenuSel);
  652.      end;
  653. end;
  654.  
  655. function PullDownMenu(MenuList:MenuPtr):byte;
  656. var
  657.         x1,y1,x2,y2,indx      :byte;
  658.         MenuMax         :byte;
  659.         pch,ch          :char;
  660.         MenuSel         :byte;
  661.         ok              :boolean;
  662. begin
  663.         MenuMax := MenuList^.Max;
  664.         TimeQuit := False;
  665.         x1 := MenuList^.x;
  666.         y1 := MenuList^.y;
  667.         x2 := x1 + MenuList^.Width + 1;
  668.         y2 := y1 + MenuList^.Max + 1;
  669.         TextColor(MenuList^.Fg);
  670.         MenuSel := MenuList^.Sel;
  671.         PDSel(MenuList,MenuSel);
  672.         MenuList^.SelPattern[1] := '*';
  673.         if MenuList^.SelPattern[MenuList^.Sel] <> '*' then
  674.             MenuList^.Sel := 1;
  675. repeat
  676.       textcolor(MenuList^.Fg);
  677.       keycode := pass_keycode(ch);
  678.       PDrtn := 0;
  679.       case keycode of
  680.            carr_rtn  :begin
  681.                         PullDownMenu := MenuSel;
  682.                         TimeQuit := true;
  683.                      end;
  684.            escape    :begin
  685.                         PullDownMenu := 0;
  686.                         TimeQuit := true;
  687.                      end;
  688.            F10       :begin
  689.                         PullDownMenu := 0;
  690.                         TimeQuit := true;
  691.                         Rtn2Main := true;
  692.                      end;
  693.            up_arr    :begin
  694.                            PDUnSel(MenuList,MenuSel);
  695.                            repeat
  696.                                 if MenuSel = menu_min then
  697.                                    MenuSel := MenuMax else
  698.                                    MenuSel := MenuSel - 1;
  699.                                 pch := MenuList^.SelPattern[MenuSel];
  700.                            until pch='*';
  701.                            PDSel(MenuList,MenuSel);
  702.                      end;
  703.            rt_arr    :if MenuList^.EnLtRt then begin
  704.                         PDrtn := rt_arr;
  705.                         PullDownMenu := 0;
  706.                         TimeQuit := true;
  707.                      end;
  708.            lt_arr    :if MenuList^.EnLtRt then begin
  709.                         PDrtn := lt_arr;
  710.                         PullDownMenu := 0;
  711.                         TimeQuit := true;
  712.                      end;
  713.            dn_arr    :begin
  714.                            PDUnSel(MenuList,MenuSel);
  715.                            repeat
  716.                                 if MenuSel = MenuMax then
  717.                                    MenuSel := menu_min else
  718.                                    MenuSel := MenuSel + 1;
  719.                                 pch := MenuList^.SelPattern[MenuSel];
  720.                            until pch='*';
  721.                            PDSel(MenuList,MenuSel);
  722.                      end;
  723.       else begin
  724.           indx := pos(ch,MenuList^.PickKey);
  725.           if ((indx <> 0) 
  726.                 and (MenuList^.SelPattern[indx] = '*'))
  727.                 then begin
  728.                        PDUnSel(MenuList,MenuSel);
  729.                        PullDownMenu := indx;
  730.                        MenuSel := indx;
  731.                        TimeQuit := true;
  732.                        PDSel(MenuList,MenuSel);
  733.                 end;
  734.           if not(TimeQuit) then bad_beep;
  735.       end;
  736.       end; {of case keycode}
  737. until TimeQuit;
  738.  
  739. MenuList^.Sel := MenuSel;
  740. end;
  741.  
  742. procedure ClosePullDownMenu(MenuList:MenuPtr);
  743. var
  744.         x1,y1,x2,y2,indx      :byte;
  745.         wx1,wy1,wx2,wy2       :byte;
  746. begin
  747.      if not(auto) then begin
  748.         x1 := MenuList^.x;
  749.         y1 := MenuList^.y;
  750.         x2 := x1 + MenuList^.Width + 1;
  751.         y2 := y1 + MenuList^.Max + 1;
  752.         restore_screen(x1,y1,x2,y2,MenuList^.ScreenBufPtr);
  753.         wx1 := lo(MenuList^.OldWindMin) + 1;
  754.         wy1 := hi(MenuList^.OldWindMin) + 1;
  755.         wx2 := lo(MenuList^.OldWindMax) + 1;
  756.         wy2 := hi(MenuList^.OldWindMax) + 1;
  757.         window(wx1,wy1,wx2,wy2);
  758.      end;
  759. end;
  760.  
  761. procedure HLsel(num,y:byte;HdrList:HdrPtr);
  762. begin
  763.      TextColor(MenuSelFg); 
  764.      TextBackGround(MenuSelBg);
  765.      gotoxy(((num-1)*HdrWidth)+1,y);
  766.      write(HdrList^.str[num]);
  767. end;
  768.  
  769. procedure HLunsel(num,y:byte;HdrList:HdrPtr);
  770. begin
  771.      TextBackGround(MenuNoSelBg);
  772.      TextColor(MenuNoSelFg); 
  773.      gotoxy(((num-1)*HdrWidth)+1,y);
  774.      write(HdrList^.str[num]);
  775.  
  776.      TextColor(PickKeyFg); 
  777.      gotoxy(((num-1)*HdrWidth)+1,y);
  778.      write(HdrList^.str[num][1]);
  779. end;
  780.  
  781. procedure OpenHeader(y:byte;HdrList:HdrPtr);
  782. var
  783.      ta        :byte;
  784.      indx      :byte;
  785. begin
  786.         ta := TextAttr;
  787.         TextColor(MenuNoSelFg); 
  788.         TextBackGround(MenuNoSelBg);
  789.         gotoxy(1,y);
  790.         clreol;
  791.  
  792.         for indx := 1 to HdrList^.Max do begin
  793.                HLunsel(indx,y,HdrList);
  794.         end;
  795.  
  796.         HLsel(HdrList^.Sel,y,HdrList);
  797.         TextAttr := ta; 
  798. end; 
  799.  
  800. function PickHeader(y:byte;HdrList:HdrPtr):byte;
  801. var
  802.         HdrSel          :byte;
  803.         HdrMax          :byte;
  804.         ta              :byte;
  805.         TempSel         :byte;
  806. begin
  807.  
  808. ta := textattr;
  809. HdrSel := HdrList^.sel;
  810. HdrMax := HdrList^.max;
  811. repeat
  812.       if (PDrtn=0) then keycode := pass_keycode(ch)
  813.            else KeyCode := PDrtn;
  814.       case keycode of
  815.            carr_rtn  :begin
  816.                         PDrtn := 0;
  817.                         PickHeader := HdrSel;
  818.                         TimeQuit := true;
  819.                      end;
  820.            lt_arr    :begin
  821.                            if PDrtn <> 0 then PDrtn := Carr_rtn;
  822.                            HLunsel(HdrSel,y,HdrList);
  823.  
  824.                            if HdrSel = 1 then
  825.                               HdrSel := HdrMax else
  826.                               HdrSel := HdrSel - 1;
  827.  
  828.                            HLsel(HdrSel,y,HdrList);
  829.                      end;
  830.            rt_arr    :begin
  831.                            if PDrtn <> 0 then PDrtn := Carr_rtn;
  832.                            HLunsel(HdrSel,y,HdrList);
  833.  
  834.                            if HdrSel = HdrMax then
  835.                               HdrSel := 1 else
  836.                               HdrSel := HdrSel + 1;
  837.  
  838.                            HLsel(HdrSel,y,HdrList);
  839.                      end;
  840.            up_arr    :begin
  841.                      end;
  842.            dn_arr    :begin
  843.                      end;
  844.            else begin
  845.                  TempSel := pos(ch,HdrList^.PickKey);
  846.                  if TempSel <> 0 then begin
  847.                        HLunsel(HdrSel,y,HdrList);
  848.                        HdrSel := TempSel;
  849.                        HLsel(HdrSel,y,HdrList);
  850.                        PickHeader := HdrSel;
  851.                        TimeQuit := true;
  852.                  end
  853.                  else bad_beep;
  854.            end;
  855.       end; {of case keycode}
  856. until TimeQuit;
  857.  
  858. HdrList^.Sel := HdrSel;
  859. TextAttr := ta;
  860. end;
  861.  
  862. procedure PLSel(InputList:PickListPtr);
  863. begin
  864.         PickListSelX := (PickListSel-1) mod PickListMaxX;
  865.         PickListSelY := ((PickListSel-1) div PickListMaxX) +1;
  866.  
  867.         Xpos := (PickListSelX*PickListWidth)+1;
  868.         Ypos := PickListSelY;
  869.         gotoxy(Xpos,Ypos);
  870.  
  871.         textbackground(InputList^.SelBg);
  872.         TextColor(InputList^.Fg);
  873.         write(InputList^.str[PickListSel]:PickListWidth);
  874. end;
  875.  
  876. procedure PLUnSel(InputList:PickListPtr);
  877. begin
  878.         Xpos := (PickListSelX*PickListWidth)+1;
  879.         Ypos := PickListSelY;
  880.         gotoxy(Xpos,Ypos);
  881.         TextColor(InputList^.NoSelFg);
  882.         textbackground(InputList^.NoSelBg);
  883.         write(InputList^.str[PickListSel]:PickListWidth);
  884. end;
  885.  
  886. Procedure OpenPickList(InputList:PickListPtr);
  887. var
  888.         l,x,w                :byte;
  889.         x1,y1,x2,y2          :byte;
  890.         indx1,indx2,indx3    :byte;
  891. begin
  892.      if not(auto) then begin
  893.         if InputList^.sel > InputList^.max then Inputlist^.sel := 1;
  894.         y := InputList^.y;
  895.         PickListMax       := InputList^.Max;
  896.         PickListMaxX      := InputList^.MaxX;
  897.         PickListMaxY      := trunc((PickListMax-1)/PickListMaxX) + 1;
  898.         x1 := InputList^.x;
  899.         x2 := PickListMaxX * PickListWidth + 2 + x1;
  900.         y1 := y;
  901.         y2 := y + PickListMaxY + 1;
  902.         sv_screen(x1,y1,x2,y2,InputList^.ScreenBufPtr);
  903.         InputList^.OldWindMin := WindMin;
  904.         InputList^.OldWindMax := WindMax;
  905.         window(1,1,80,25);
  906.         border(x1,y1,x2,y2,InputList^.BorderFg,InputList^.BorderBg);
  907.         l := length(InputList^.Title);
  908.         if l <> 0 then begin
  909.                 x := round((x2-x1-l)/2) + x1;
  910.                 gotoxy(x,y1);
  911.                 write(InputList^.Title);
  912.         end;
  913.         window(succ(x1),succ(y1),pred(x2),pred(y2));
  914.         TextColor(InputList^.NoSelFg);
  915.         TextBackground(InputList^.NoSelBg);
  916.         clrscr;
  917.         indx3 := 0;
  918.         for indx2 := 1 to PickListMaxY do begin
  919.             gotoxy(1,indx2);
  920.             for indx1 := 1 to PickListMaxX do begin
  921.                 indx3 := indx3 + 1;
  922.                 if indx3 <= PickListMax then
  923.                     write(InputList^.str[indx3]:PickListWidth);
  924.             end;
  925.         end;
  926.  
  927.         PickListSel  := InputList^.sel;
  928.         PLSel(InputList);
  929.      end;
  930. end;
  931.  
  932. function PickList(InputList:PickListPtr):byte;
  933. begin
  934.         PickListMax   := InputList^.Max;
  935.         PickListMaxX  := InputList^.MaxX;
  936.         TimeQuit := False;
  937.         SetTxtFg(InputList^.Fg);
  938.         SetTxtBg(InputList^.NoSelBg);
  939.         y := InputList^.y;
  940.  
  941.         MaxRows := (trunc(PickListMax/PickListMaxX)+1);
  942.  
  943.         PickListSel  := InputList^.sel;
  944.         PLSel(InputList);
  945.  
  946. repeat
  947.       PDrtn := 0;
  948.       keycode := pass_keycode(ch);
  949.       case keycode of
  950.            carr_rtn  :begin
  951.                         InputList^.sel := PickListSel;
  952.                         PickList := PickListSel;
  953.                         TimeQuit := true;
  954.                      end;
  955.            escape   :begin
  956.                         InputList^.sel := PickListSel;
  957.                         PickList := 0;
  958.                         TimeQuit := true;
  959.                      end;
  960.            F10      :begin
  961.                         InputList^.sel := PickListSel;
  962.                         PickList := 0;
  963.                         TimeQuit := true;
  964.                         Rtn2Main := true;
  965.                      end;
  966.            lt_arr    :begin
  967.                            PLUnSel(InputList);
  968.                            if PickListSel = 1 then
  969.                               PickListSel := PickListMax else
  970.                               PickListSel := PickListSel - 1;
  971.                            PLSel(InputList);
  972.                      end;
  973.  
  974.            rt_arr    :begin
  975.                            PLUnSel(InputList);
  976.                            if PickListSel = PickListMax then
  977.                               PickListSel := 1 else
  978.                               PickListSel := PickListSel + 1;
  979.                            PLSel(InputList);
  980.                      end;
  981.            up_arr    :begin
  982.                            PLUnSel(InputList);
  983.                            if PickListSelY <> 1 then begin
  984.                                    PickListSel := PickListSel - PickListMaxX;
  985.                                    PickListSelY := trunc((PickListSel-1)/PickListMaxX)+1;
  986.                            end
  987.                            else begin
  988.                                    if ((MaxRows-1) * PickListMaxX) + (PickListSelX+1) > PickListMax then
  989.                                       PickListSelY := MaxRows-1 else
  990.                                       PickListSelY := MaxRows;
  991.                                     PickListSel := ((PickListSelY-1)*PickListMaxX)+PickListSelX+1;
  992.                            end;
  993.                            PLSel(InputList);
  994.                      end;
  995.            dn_arr    :begin
  996.                            PLUnSel(InputList);
  997.                            if PickListSel <= PickListMax - PickListMaxX then
  998.                               PickListSel := PickListSel + PickListMaxX else
  999.                               PickListSel := PickListSelX + 1;
  1000.                            PLSel(InputList);
  1001.                      end;
  1002.            fn_home   :begin
  1003.                            PLUnSel(InputList);
  1004.                            PickListSel := 1;
  1005.                            PLSel(InputList);
  1006.                      end;
  1007.            fn_end    :begin
  1008.                            PLUnSel(InputList);
  1009.                            PickListSel := PickListMax;
  1010.                            PLSel(InputList);
  1011.                      end;
  1012.       else bad_beep;
  1013.       end; {of case keycode}
  1014. until TimeQuit;
  1015. end;
  1016.  
  1017. procedure ClosePickList(InputList:PickListPtr);
  1018. var
  1019.         x1,y1,x2,y2,indx,y    :byte;
  1020.         wx1,wy1,wx2,wy2       :byte;
  1021.         PickListMax          :byte;
  1022. begin
  1023.      if not(auto) then begin
  1024.         y := InputList^.y;
  1025.         PickListMax       := InputList^.Max;
  1026.         PickListMaxX      := InputList^.MaxX;
  1027.         PickListMaxY      := trunc((PickListMax-1)/PickListMaxX) +1;
  1028.         x1 := InputList^.x;
  1029.         x2 := PickListMaxX * PickListWidth + 2 + x1;
  1030.         y1 := y;
  1031.         y2 := y + PickListMaxY + 1;
  1032.         restore_screen(x1,y1,x2,y2,InputList^.ScreenBufPtr);
  1033.         wx1 := lo(InputList^.OldWindMin) + 1;
  1034.         wy1 := hi(InputList^.OldWindMin) + 1;
  1035.         wx2 := lo(InputList^.OldWindMax) + 1;
  1036.         wy2 := hi(InputList^.OldWindMax) + 1;
  1037.         window(wx1,wy1,wx2,wy2);
  1038.      end;
  1039. end;
  1040.  
  1041. procedure UpdateMenu(MenuName:MenuPtr);
  1042. var
  1043.      w         :integer;
  1044.      s         :string[1];
  1045.      pch       :char;
  1046.      indx      :integer;
  1047.      vp        :InpStrPtr;
  1048.      ok        :boolean;
  1049.      fc        :byte;
  1050. begin
  1051.      if not(auto) then begin
  1052.         ok := false;
  1053.         for indx := 1 to MenuName^.Max do begin
  1054.                pch := MenuName^.SelPattern[indx];
  1055.                if pch='*' then ok := true;
  1056.         end;
  1057.         if not ok then 
  1058.               for indx := 1 to MenuName^.Max do 
  1059.                      MenuName^.SelPattern[indx] := '*';
  1060.  
  1061.      w := MenuName^.Width - MenuName^.TxtLen - 2;
  1062.      TextColor(MenuName^.VarFg);
  1063.      TextBackground(MenuName^.VarBg);
  1064.      if MenuName^.VarPtr <> nil then begin
  1065.           vp := MenuName^.VarPtr;
  1066.           for indx := 1 to MenuName^.Max do begin
  1067.                gotoxy(MenuName^.TxtLen+1,indx);
  1068.                write(' ');
  1069.                if length(Vp^[indx].Str) > W then begin
  1070.                     Delete(Vp^[indx].Str,W+1,80);
  1071.                     Vp^[indx].Str[W-1] := ' ';
  1072.                     Vp^[indx].Str[W] := '>';
  1073.                end;
  1074.                write(vp^[indx].Str:w);
  1075.                write(' ');
  1076.           end;
  1077.      end;
  1078.         TextBackground(MenuName^.NoSelBg);
  1079.         for indx := 1 to MenuName^.Max do PDunsel(MenuName,indx);
  1080.  
  1081.         TextColor(MenuName^.Fg); 
  1082.         PDSel(MenuName,MenuName^.Sel);
  1083.      end;
  1084. end;
  1085.  
  1086. procedure GetFile(var RtnFileName:FileString;FileMask:FileString;path:linestrg;var RtnCode:byte);
  1087. var
  1088.      MenuVal        :byte;
  1089.      i,indx         :integer;
  1090.      SearchFile     :linestrg;
  1091.      FilePath       :Linestrg;
  1092.      DirInfo        :searchrec;
  1093. begin
  1094.      if not(auto) then begin
  1095.      FilePath := path;
  1096.      if FilePath = '' then begin
  1097.           GetDir(0,FilePath);
  1098.      end;
  1099.      if FilePath[length(FilePath)] <> '\' 
  1100.           then FilePath := FilePath + '\';
  1101.      SearchFile := FilePath + FileMask;
  1102.      findfirst(SearchFile,anyfile,dirinfo);
  1103.      DirList^.str[1] := '';
  1104.      i := 1;
  1105.      while ((doserror = 0) and (i < PickListMaxStr)) do begin
  1106.            i := i + 1;
  1107.            indx := length(dirinfo.name);
  1108.            DirList^.str[i] := dirinfo.name;
  1109.            findnext(dirinfo);
  1110.      end;
  1111.      if i > 1 then begin
  1112.           DirList^.Max := i;
  1113.           DirList^.Title := 'Directory of ' + SearchFile;
  1114.           OpenPickList(DirList);
  1115.           MenuVal := PickList(DirList);
  1116.           if MenuVal <> 0 then begin
  1117.                RtnFileName := DirList^.str[MenuVal];
  1118.                RtnCode := FilePicked;
  1119.           end
  1120.           else RtnCode := NoFilePicked;
  1121.           ClosePickList(DirList);
  1122.      end
  1123.      else begin
  1124.           RtnCode := NoFileFound;
  1125.      end;
  1126.      end;
  1127. end;
  1128.  
  1129. Function exist(FileName:linestrg):boolean;
  1130. begin
  1131.      FindFirst(FileName,AnyFile,DirInfo);
  1132.      if DosError=0 then exist := true
  1133.           else exist := false;
  1134. end;
  1135.  
  1136. Function LoadHelpFile(var HelpFilePath:LineStrg;HelpFileName:FileString):boolean;
  1137. const
  1138.      PathLength     = 30;
  1139.      FilePlusPath   = 42;
  1140. var
  1141.      KeepTrying     :boolean;
  1142.      Found          :boolean;
  1143.      rc,ta          :byte;
  1144.      HelpFileString :string[FilePlusPath];
  1145. begin
  1146.      found := false;
  1147.      if exist(HelpFileName) then begin
  1148.           HelpFilePath := '';
  1149.           HelpFileString := HelpFileName;
  1150.           Found := true
  1151.      end
  1152.      else begin
  1153.           HelpFileString := HelpFilePath + HelpFileName;
  1154.           if exist(HelpFileString) then 
  1155.                Found := true;
  1156.      end;
  1157.      if not(Found) then begin
  1158.           KeepTrying := true;
  1159.           UnHideCurs;
  1160.           OpenIoWindow(HelpList);
  1161.           ta := TextAttr;
  1162.           repeat
  1163.                TextAttr := ta;
  1164.                if HelpFilePath[length(HelpFilePath)] <> '\' 
  1165.                     then HelpFilePath := HelpFilePath + '\';
  1166.                HelpFileString := HelpFilePath + HelpFileName;
  1167.                if exist(HelpFileString) then begin
  1168.                     KeepTrying := false;
  1169.                     Found := true;
  1170.                end
  1171.                else begin
  1172.                     writeln('Help file NOT found...');
  1173.                     write('New path, (<esc> to stop trying):  ');
  1174.                     TextColor(VarInpFg);
  1175.                     TextBackground(VarInpBg);
  1176.                     InputString('',PathLength,HelpFilePath,rc);
  1177.                     if rc <> 0 then begin
  1178.                          KeepTrying := false;
  1179.                          Found := False;
  1180.                     end;
  1181.                end;
  1182.           until not KeepTrying;
  1183.           CloseIoWindow(HelpList);
  1184.           TextAttr := ta;
  1185.           HideCurs;
  1186.      end;
  1187.      if found then begin
  1188.           assign(HelpFile,HelpFileString);
  1189.           reset(HelpFile);
  1190.           MaxHelps := FileSize(HelpFile);
  1191.      end;
  1192.      LoadHelpFile := found;
  1193. end;
  1194.  
  1195. function Confirmed(InitVal,Auto: boolean):boolean;
  1196. var
  1197.      menu :byte;
  1198. begin
  1199.      if Auto then Confirmed := true
  1200.      else begin
  1201.           if InitVal then ConfirmMenu^.sel := 1
  1202.                Else ConfirmMenu^.sel := 2;
  1203.           OpenPullDownMenu(ConfirmMenu);
  1204.           Menu := PullDownMenu(ConfirmMenu);
  1205.           if Menu = 1 then Confirmed := true
  1206.                else Confirmed := False;
  1207.           ClosePullDownMenu(ConfirmMenu);
  1208.      end;
  1209. end;
  1210.  
  1211. procedure InitMenuCode;
  1212. begin
  1213.      PDrtn := Carr_Rtn;
  1214.      new(DirScreen); 
  1215.      new(DirList);
  1216.         DirList^.sel      := 1;
  1217.         DirList^.y        := 13;
  1218.         DirList^.x        := 1;
  1219.         DirList^.MaxX     := 5;
  1220.         DirList^.BorderBg := MenuBorderBg;
  1221.         DirList^.BorderFg := MenuBorderFg;
  1222.         DirList^.Fg       := MenuSelFg;
  1223.         DirList^.SelBg    := MenuSelBg;
  1224.         DirList^.NoSelBg  := MenuNoSelBg;
  1225.         DirList^.NoSelFg  := MenuNoSelFg;
  1226.         DirList^.title    := 'Directory';
  1227.         DirList^.ScreenBufPtr := DirScreen;
  1228.  
  1229.      New(ConfirmScreen);
  1230.      New(ConfirmMenu);
  1231.         ConfirmMenu^.str[1]   := 'Yes ';
  1232.         ConfirmMenu^.str[2]   := 'No ';
  1233.         ConfirmMenu^.str[3]   := '';
  1234.         ConfirmMenu^.PickKey  := 'YN';
  1235.         ConfirmMenu^.EnLtRt   := false;
  1236.         ConfirmMenu^.max      := 3;
  1237.         ConfirmMenu^.SelPattern := '** *****';
  1238.         ConfirmMenu^.NoSelFg  := black;
  1239.         ConfirmMenu^.sel      := 1;
  1240.         ConfirmMenu^.x        := 57;
  1241.         ConfirmMenu^.y        := 5;
  1242.         ConfirmMenu^.TxtLen   := 14;
  1243.         ConfirmMenu^.Width    := 14;
  1244.         ConfirmMenu^.BorderBg := MenuBorderBg;
  1245.         ConfirmMenu^.BorderFg := MenuBorderFg + blink;
  1246.         ConfirmMenu^.Fg       := MenuHiFg;
  1247.         ConfirmMenu^.SelFg    := MenuSelFg;
  1248.         ConfirmMenu^.SelBg    := MenuSelBg;
  1249.         ConfirmMenu^.NoSelBg  := MenuNoSelBg;
  1250.         ConfirmMenu^.NoSelFg  := MenuLoFg;
  1251.         ConfirmMenu^.VarFg    := MenuVarFg;
  1252.         ConfirmMenu^.VarBg    := MenuVarBg;
  1253.         ConfirmMenu^.title    := 'Confirm?';
  1254.         ConfirmMenu^.ScreenBufPtr:= ConfirmScreen;
  1255. end;
  1256.  
  1257. begin
  1258.      PDrtn := 0;
  1259. end.
  1260. 
  1261.  
  1262.