home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / BOXMENU.ZIP / BOXMENU.BOX next >
Encoding:
Text File  |  1985-09-17  |  22.8 KB  |  608 lines

  1. {----------------------------------------------------------------------}
  2. {           BOXMENU.BOX   ---  Menu Routines for Turbo Pascal          }
  3. {----------------------------------------------------------------------}
  4. {                                                                      }
  5. {  What these routines do:                                             }
  6. {                                                                      }
  7. {    These routines provide a straight-forward  vertical  selection    }
  8. {    facility.  A  pop-up  window  holds  the  menu.  The  menu  is    }
  9. {    contained in a frame.  The  items  are  displayed  within  the    }
  10. {    frame.  The  currently selected item is highlighted.  You move    }
  11. {    up and down in the list of menu items by using the up and down    }
  12. {    arrow keys,  or the space bar.  To make a selection,  hit  the    }
  13. {    Enter  (Return)  key.  The  First  non-blank character in each    }
  14. {    entry, or a Function Key.                                         }
  15. {                                                                      }
  16. {    Note that code for stacked windows is available here.  You may    }
  17. {    want to modify this to  use  compile-time  window  spaces,  or    }
  18. {    remove the current push-down stack structure.                     }
  19. {                                                                      }
  20. {    NOTES: The include files "SCRNDEF.BOX",  "SCRNSAVE.BOX",  and     }
  21. {           "KBDCHAR.BOX"  must  be  placed in front of this source    }
  22. {           code.                                                      }
  23. {                                                                      }
  24. {    Before  Using any procedures or functions in this box,  a Call    }
  25. {    to the procedure "Set_Screen_Address" must be made  this  will    }
  26. {    initialize  a  data  variable with the address of the color or    }
  27. {    monochrome screen memory.                                         }
  28. {                                                                      }
  29. {----------------------------------------------------------------------}
  30.  
  31. Const
  32.    Max_Mnu_Items   =  10;   { Maximum number of menu choices }
  33.  
  34.  
  35.                    { Menu Types }
  36. Type
  37.   Mnu_Str  = String[40]  { Matches any string for parameter passing };
  38.  
  39.  
  40.  
  41. {----------------------------------------------------------------------}
  42. {                Draw_Mnu_Frame --- Draw a Frame                       }
  43. {----------------------------------------------------------------------}
  44. procedure Draw_Mnu_Frame( X1,  Y1,
  45.                           Width,  NoOfLines : byte;
  46.                           FC, BC : byte );
  47. {----------------------------------------------------------------------}
  48. {     Purpose:    Draws a titled frame using PC graphics characters    }
  49. {----------------------------------------------------------------------}
  50. Type
  51.   ConstStrType = string[80];
  52.  
  53. {----------------------------------------------------------------------}
  54. {     ConstStr returns a string with N characters of value C           }
  55. {----------------------------------------------------------------------}
  56.   function ConstStr( C : char;
  57.                      N : byte ) : ConStStrType;
  58.   Var
  59.     S : string[80];
  60.   begin
  61.     if N < 0 then N := 0;
  62.     S[0] := Chr(N);
  63.     FillChar(S[1],N,C);
  64.     ConstStr := S;
  65.   end;
  66.  
  67.  
  68. Var
  69.    i  : integer;
  70.  
  71. begin { Draw_Mnu_Frame }
  72.   TextColor( FC );
  73.   TextBackground( BC );
  74.  
  75.   GotoXY( X1, Y1 );
  76.   Write( '┌' ); Write( ConstStr( '─', Width-2 ) ); Write( '┐' );
  77.  
  78.   GotoXY( X1, Y1+1 ); Write( '│' );
  79.   GotoXY( X1+Width-1, Y1+1 ); Write( '│' );
  80.  
  81.   GotoXY( X1, Y1+2 );
  82.   Write( '├' ); Write( ConstStr( '─', Width-2 ) ); Write( '┤' );
  83.  
  84.   for i := Y1+3  to NoOfLines+Y1+2 do begin
  85.     GotoXY( X1, i ); Write( '│' );
  86.     GotoXY( X1+Width-1, i ); Write( '│' );
  87.   end;
  88.  
  89.   GotoXY( X1, Y1+NoOfLines+3 );
  90.   Write( '└' ); Write( ConstStr( '─', Width-2 ) ); Write( '┘' );
  91.  
  92. end;   { Draw_Mnu_Frame }
  93.  
  94.  
  95. {----------------------------------------------------------------------}
  96. {                Center --- Center the String on the menu line         }
  97. {----------------------------------------------------------------------}
  98. procedure Mnu_Center( L       : integer;
  99.                       Str     : Mnu_Str;
  100.                       Width   : byte   );
  101. begin  {  Mnu_Center  }
  102.     If Ord(Str[0]) > Width-2 then Str[0] := Chr( Width-2 );
  103.     GotoXY( ( ( Width-Length( Str ) ) div 2 ) + 1, L );
  104.     Write( Str );
  105. end;   {  Mnu_Center  }
  106.  
  107.  
  108. {----------------------------------------------------------------------}
  109. {                Mnu_Turn_On --- Highlight Menu Choice                 }
  110. {----------------------------------------------------------------------}
  111.  
  112. procedure Mnu_Turn_On( Num       : byte;     { Line number for item    }
  113.                        Str       : Mnu_Str;  { Item In String Format   }
  114.                        Width     : byte;     { Width of Menu Area      }
  115.                        ForeColor : byte;     { Foreground Color        }
  116.                        HiLite    : byte;     { The highlight amount    }
  117.                        BackColor : byte );   { Background color        }
  118.  
  119. {----------------------------------------------------------------------}
  120. {  When the field is high lighted, the foreground color is the normal  }
  121. {  foreground color plus the High Light amount ( ForeColor+HiLite ).   }
  122. {  This allows fine control of the menu colors.                        }
  123. {  If the Map Background color is black,the background is set to       }
  124. {  white(lightgray).  Any other color will use a black background.     }
  125. {----------------------------------------------------------------------}
  126.  
  127.  
  128. begin  {  Mnu_Turn_On  }
  129.   if BackColor = Black
  130.     then TextBackground( LightGray )
  131.     else TextBackground( Black );
  132.   TextColor( ForeColor + HiLite );
  133.   Mnu_Center( Num, Str, Width );
  134.  
  135. end;   {  Mnu_Turn_On  }
  136.  
  137.  
  138. {----------------------------------------------------------------------}
  139. {                Mnu_Turn_Off --- UnHighlight Menu Choice              }
  140. {----------------------------------------------------------------------}
  141.  
  142. procedure Mnu_Turn_Off( Num       : byte;
  143.                         Str       : Mnu_Str;
  144.                         Width     : byte;
  145.                         ForeColor : byte;
  146.                         HiLite    : byte;
  147.                         BackColor : byte );
  148.  
  149. begin  {  Mnu_Turn_Off  }
  150.   TextBackground( BackColor );
  151.   TextColor( ForeColor );
  152.   Mnu_Center( Num, Str, Width );
  153. end;   {  Mnu_Turn_Off  }
  154.  
  155.  
  156. {----------------------------------------------------------------------}
  157. {                BoxMenuDisplay --- Display Blank Menu                 }
  158. {----------------------------------------------------------------------}
  159.  
  160. procedure BoxMenuDisplay(
  161.                                              { ULC = Upper Left Corner }
  162.                       Mnu_Column   : byte;   { Pos for ULC of menu     }
  163.                       Mnu_Line     : byte;   { Line # for ULC of menu  }
  164.                       Mnu_Width    : integer;{ Width of menu           }
  165.  
  166.                       Mnu_ItemCtr  : byte;   { No. of items in menu    }
  167.  
  168.                       Mnu_ForeColor: integer;{ Foreground text color   }
  169.                       Mnu_BackColor: integer );{ BackGround color      }
  170.  
  171. {----------------------------------------------------------------------}
  172. {  This Procedure DOES NOT SAVE OR RESTORE THE SCREEN!!!!!!!           }
  173. {  It MAY be used externally to create menus that are not              }
  174. {  standard menus.                                                     }
  175. {----------------------------------------------------------------------}
  176.  
  177.  
  178. begin { BoxMenuDisplay }
  179.  
  180. { Create Window For Menu  }
  181.   Mnu_Window( Mnu_Column, Mnu_Line,
  182.               Mnu_Column+Mnu_Width, Mnu_Line+Mnu_ItemCtr+3 );
  183.  
  184.   TextColor( Mnu_ForeColor );
  185.   TextBackground( Mnu_BackColor );
  186.   ClrScr;
  187.  
  188. { Reset Window }
  189.   Mnu_Window( 1, 1, 80, 25 );
  190.  
  191. { Draw the Menu Frame }
  192.   Draw_Mnu_Frame( Mnu_Column, Mnu_Line,
  193.                   Mnu_Width, Mnu_ItemCtr,
  194.                   Mnu_ForeColor, Mnu_BackColor );
  195.  
  196. { Create Window For Menu  }
  197.   Mnu_Window( Mnu_Column, Mnu_Line,
  198.               Mnu_Column+Mnu_Width, Mnu_Line+Mnu_ItemCtr+4 );
  199.  
  200. End   { BoxMenuDisplay };
  201.  
  202.  
  203.  
  204. {----------------------------------------------------------------------}
  205. {                Cursor Control --- Alter Cursor Appearance            }
  206. {----------------------------------------------------------------------}
  207.  
  208. procedure CursorSelect( a, b : integer );
  209.  
  210. Var
  211.    Regs : Record       { 8088 registers }
  212.              Ax, Bx, Cx, Dx, Bp, Si, Di, Ds, Es, Flags : integer
  213.           End;
  214.  
  215. begin   {  CursorSelect  }
  216.   if ( a in [0..8] ) and ( b in [0..7] ) then begin
  217.     Regs.Ax:= $0100;            { ah = set cursor type in high        }
  218.                                 {      order byte of the register     }
  219.     Regs.Cx := ( a shl 8 ) + b; { set cursor                }
  220.     Intr( 16, Regs );           { issue interupt for        }
  221.                                 { video_io                  }
  222.   end;
  223. end;  {  CursorSelect  }
  224.  
  225.  
  226. procedure NoCursor;
  227. begin  {  NoCursor  }
  228.   CursorSelect( 8, 0 )
  229. end;   {  NoCursor  }
  230.  
  231. procedure NormCursor;
  232. begin  {  NormCursor  }
  233.   CursorSelect( 6, 7 )
  234. end;   {  NormCursor  }
  235.  
  236.  
  237. {----------------------------------------------------------------------}
  238. {                BoxStringRead --- Get Menu String                     }
  239. {----------------------------------------------------------------------}
  240.  
  241. function BoxStringRead(
  242. { ULC = Upper Left Corner }
  243. { Pos for ULC of menu     }     Mnu_Column   : byte;
  244. { Line # for ULC of menu  }     Mnu_Line     : byte;
  245. { Width of menu           }     Mnu_Width    : byte;
  246.  
  247. { Number of Lines in Box    }   Mnu_ItemCtr  : byte;
  248.  
  249. { Foreground text color     }   Mnu_ForeColor: byte;
  250. { BackGround color          }   Mnu_BackColor: byte;
  251. { Color for the Menu Fields }   Mnu_FldColor : byte;
  252. { the menu title            }   Mnu_Title    : Mnu_Str;
  253. { Default value for String  }   Mnu_Default  : Mnu_Str;
  254. { Force Upper Case on String}   Mnu_Case     : Char;
  255. { start of field /position  }   Mnu_InPos    : byte;
  256. { Line for Input Field      }   Mnu_InLine   : byte;
  257. { Length of Input Field     }   Mnu_Buflen   : byte  )  : Mnu_Str;
  258.  
  259. Var
  260.    Done,
  261.    Initial : boolean;
  262.    Ch      : char;
  263.    WorkStr : Mnu_Str;
  264.    i       : integer;
  265. begin  {  BoxStringRead  }
  266.   Done := false;  Initial := true;
  267.   Mnu_Case := UpCase( Mnu_Case );
  268.   FillChar(WorkStr, SizeOf(WorkStr), 0 );
  269. { Create Window For Menu  }
  270.   Mnu_Window( Mnu_Column, Mnu_Line,
  271.               Mnu_Column+Mnu_Width, Mnu_Line+Mnu_InLine+3 );
  272.  
  273.   Mnu_Center( 2, Mnu_Title, Mnu_Width );
  274.  
  275.   TextColor( Mnu_FldColor );
  276.   GotoXY( Mnu_InPos, Mnu_InLine+3 );
  277.   if Mnu_Case = 'U' 
  278.     then for i := 1 to Length( Mnu_Default ) do 
  279.     Mnu_Default[i] := UpCase( Mnu_Default[i] );
  280.   Write( Mnu_Default );
  281.  
  282.   GotoXY( Mnu_InPos, Mnu_InLine+3 );
  283.   repeat
  284.     Read( kbd, Ch );
  285.     Case Ch of
  286.       CtrlBreak: begin
  287.                    Read( kbd, Ch );
  288.                    if Ch = CtrlBreak then Halt;
  289.                  end;
  290.       BackSpace: if Length( WorkStr ) > 0 then begin
  291.                    Delete( WorkStr, Length( WorkStr ), 1 );
  292.                    Write( BackSpace, ' ', BackSpace );
  293.                  end
  294.                  else Write( Bell );
  295.  
  296.       Escape   : if ( Length( WorkStr ) > 0 ) and not KeyPressed
  297.                    then WorkStr := ''
  298.                  else begin
  299.                    Done := true;
  300.                    BoxStringRead := WorkStr;
  301.                  end;
  302.       Return   : begin
  303.                    if Initial then WorkStr := Mnu_Default;
  304.                    Done := true;
  305.                  end;
  306.       ' '..'~' : begin
  307.                    if Initial then begin
  308.                      Initial := false;
  309.                      Write( ' ' : Mnu_Buflen-1 );
  310.                      GotoXY( Mnu_InPos, Mnu_InLine+3 );
  311.                    end;  
  312.                    if Length( WorkStr ) < Mnu_Buflen then begin
  313.                      if Mnu_Case = 'U' then Ch := UpCase( Ch );
  314.                      WorkStr := WorkStr + Ch;
  315.                      Write( Ch );
  316.                    end;
  317.                  end;
  318.  
  319.     else Write( ^G );
  320.     end;  {  Case Ch of  }
  321.   until Done;
  322.   BoxStringRead := WorkStr;
  323. end;   {  BoxStringRead  }
  324.  
  325.  
  326.  
  327. {----------------------------------------------------------------------}
  328. {                BoxMenuSelect --- Get Menu Choice                     }
  329. {----------------------------------------------------------------------}
  330.  
  331. function BoxMenuSelect(
  332. { ULC = Upper Left Corner }
  333. { Pos for ULC of menu     }     Mnu_Column   : byte;
  334. { Line # for ULC of menu  }     Mnu_Line     : byte;
  335. { Width of menu           }     Mnu_Width    : byte;
  336.  
  337. { No. of items in menu    }     Mnu_ItemCtr  : byte;
  338.  
  339. { Foreground text color     }   Mnu_ForeColor: byte;
  340. { BackGround color          }   Mnu_BackColor: byte;
  341.  
  342. { Color for the Menu Fields }   Mnu_FldColor : byte;
  343. { HighLight Field Increment }   Mnu_HiLite   : byte;
  344. { the menu title            }   Mnu_Title    : Mnu_Str;
  345. { Code for keys accepted    }   Mnu_Code     : byte;
  346.  
  347. { Field Initially Selected  }   Mnu_Select   : byte;
  348. { Fields Exp1 thru Exp10 }      Exp1         : Mnu_Str;
  349.                                 Exp2         : Mnu_Str;
  350.                                 Exp3         : Mnu_Str;
  351.                                 Exp4         : Mnu_Str;
  352.                                 Exp5         : Mnu_Str;
  353.                                 Exp6         : Mnu_Str;
  354.                                 Exp7         : Mnu_Str;
  355.                                 Exp8         : Mnu_Str;
  356.                                 Exp9         : Mnu_Str;
  357.                                 Exp10        : Mnu_Str )  : integer;
  358. {                                                                      }
  359. { Remarks:                                                             }
  360. { The current menu item is highlighted.                                }
  361. {                                                                      }
  362. {   The Menu item value returned may be chosen by:                     }
  363. {     1. Hitting the return key.                                       }
  364. {                                                                      }
  365. {     2. Move to a different item with the Up/Left and                 }
  366. {        Down/Right cursor keys, then hit return key.                  }
  367. {                                                                      }
  368. {     3. Type first character in menu item (case doesn't matter).      }
  369. {                                                                      }
  370. {     4. Type function key for item number in list.                    }
  371. {                                                                      }
  372.  
  373. Var
  374.    Done    : boolean;
  375.    i, j    : byte;
  376.    WorkStr : Array [1..10] of Mnu_Str;
  377.    Choices : Array [ 1..10 ] of Char;
  378.    Ch, ECh : Char;
  379.    Int     : integer;
  380.    Old_Select : byte;
  381.  
  382. begin  {  BoxMenuSelect  }
  383.   NoCursor;
  384.   Done := false;
  385.   FillChar( Choices, SizeOf( Choices ), 0 );
  386.  
  387. { Create Window For Menu  }
  388.   Mnu_Window( Mnu_Column, Mnu_Line,
  389.               Mnu_Column+Mnu_Width, Mnu_Line+Mnu_ItemCtr+4 );
  390.  
  391.   Mnu_Center( 2, Mnu_Title, Mnu_Width );
  392.   TextColor( Mnu_FldColor );
  393.   for i := 1 to Mnu_ItemCtr do begin
  394.     Case i of
  395.       1 : WorkStr[i] := Exp1;      2 : WorkStr[i] := Exp2;
  396.       3 : WorkStr[i] := Exp3;      4 : WorkStr[i] := Exp4;
  397.       5 : WorkStr[i] := Exp5;      6 : WorkStr[i] := Exp6;
  398.       7 : WorkStr[i] := Exp7;      8 : WorkStr[i] := Exp8;
  399.       9 : WorkStr[i] := Exp9;      10: WorkStr[i] := Exp10;
  400.     end;
  401.  
  402.     j := 1;  {  Find first non-blank character in menu item  }
  403.     while ( WorkStr[i] [j] = ' ') and ( j <= Length( WorkStr[i] ) ) do
  404.     j := j + 1;
  405.     if j < Length( WorkStr[i] )
  406.       then Choices[i] := UpCase( WorkStr[i] [j] );
  407.     Mnu_Center( i+3, WorkStr[i], Mnu_Width );
  408.   end;  {  for i := 1 to Mnu_ItemCtr  }
  409.  
  410.   if ( Mnu_Select < 1 )
  411.   or ( Mnu_Select > Mnu_ItemCtr )
  412.     then Mnu_Select := 1;
  413.  
  414.   Repeat  { Loop until return key hit }
  415.  
  416.     Mnu_Turn_On( Mnu_Select+3, WorkStr[Mnu_Select], Mnu_Width,
  417.                  Mnu_FldColor, Mnu_HiLite, Mnu_BackColor );
  418.     Ch := Chr(00);
  419.     ECh := Chr(00);
  420.     Read( kbd , Ch );
  421.     Sound(3000);  { make a short sound }
  422.     NoSound;
  423.     if ( Ch = ^[ {Esc} ) and KeyPressed then Read( kbd, ECh );
  424.  
  425.     Mnu_Turn_Off( Mnu_Select+3, WorkStr[Mnu_Select], Mnu_Width,
  426.                   Mnu_FldColor, Mnu_HiLite, Mnu_BackColor );
  427.  
  428.     if ( Ch = Chr( 27 ) )  and  ( Ech <> Chr( 0 ) ) then begin
  429.       Case Ord(Ech) of
  430.         f1..f10 : if (Mnu_Code=3) or (Mnu_Code=4) then begin 
  431.                     if (Ord( Ech )-58) <= Mnu_ItemCtr then begin
  432.                       BoxMenuSelect := Ord( ECh );
  433.                       Done:= true;
  434.                     end
  435.                     else Write( Bell );
  436.                   end
  437.                   else Write( Bell );
  438.         CurHome : Mnu_Select := 1;
  439.         CurUp   : begin
  440.                     Mnu_Select := Mnu_Select-1;
  441.                     if Mnu_Select < 1 then Mnu_Select := Mnu_ItemCtr;
  442.                   end;
  443.         CurEnd  : Mnu_Select := Mnu_ItemCtr;
  444.         CurDn   : begin
  445.                     Mnu_Select := Mnu_Select+1;
  446.                     if Mnu_Select > Mnu_ItemCtr then Mnu_Select := 1;
  447.                   end;
  448.       end;  {  Case Ord(Ech) of  }
  449.  
  450.     end
  451.     else begin
  452.       Ch := UpCase( Ch );
  453.       Case  Ch  of
  454.         CtrlBreak  : begin
  455.                        Read( kbd, Ch );
  456.                        if Ch = CtrlBreak then Halt;
  457.                      end;
  458.         BackSpace  : begin
  459.                        Mnu_Select := Mnu_Select-1;
  460.                        if Mnu_Select < 1 then Mnu_Select := Mnu_ItemCtr;
  461.                      end;
  462.         ForwardTab,
  463.         SpaceBar   : begin
  464.                        Mnu_Select := Mnu_Select+1;
  465.                        if Mnu_Select > Mnu_ItemCtr then Mnu_Select := 1;
  466.                      end;
  467.         Escape     : if (Mnu_Code=1) or (Mnu_Code=3) then begin
  468.                        Done := true;
  469.                        BoxMenuSelect := 0;
  470.                      end
  471.                      else Write( Bell );
  472.         Return     : begin
  473.                        Done := true;
  474.                        BoxMenuSelect := Mnu_Select;
  475.                      end;
  476.         'A'..'Z',
  477.         '0'..'9'   : begin
  478.                        i := 1;
  479.                        while ( i < Mnu_ItemCtr ) and ( Choices[i] <> Ch ) do
  480.                        i := i+1;
  481.                        if i <= Mnu_ItemCtr then begin
  482.                          Done:= true;
  483.                          BoxMenuSelect := i;
  484.                        end
  485.                        else Write( Bell );
  486.                      end;
  487.       end;  {  Case  Ch   }
  488.     end;
  489.  
  490.   Until Done;
  491.  
  492.  
  493.   NormCursor;
  494. end;   {  BoxMenuSelect  }
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501. {----------------------------------------------------------------------}
  502. {           BoxMenu --- Display and Select Menu Choice                 }
  503. {----------------------------------------------------------------------}
  504.  
  505. function BoxMenu(
  506. { ULC = Upper Left Corner }
  507. { Pos for ULC of menu     }     Mnu_Column   : byte;
  508. { Line # for ULC of menu  }     Mnu_Line     : byte;
  509. { Width of menu           }     Mnu_Width    : byte;
  510.  
  511. { No. of items in menu    }     Mnu_ItemCtr  : byte;
  512.  
  513. { Foreground text color     }   Mnu_ForeColor: byte;
  514. { BackGround color          }   Mnu_BackColor: byte;
  515.  
  516. { Color for the Menu Fields }   Mnu_FldColor : byte;
  517. { HighLight Field Increment }   Mnu_HiLite   : byte;
  518. { the menu title            }   Mnu_Title    : Mnu_Str;
  519. { Code for keys accepted    }   Mnu_Code     : byte;
  520.  
  521. { Field Initially Selected  }   Mnu_Select   : byte;
  522. { Fields Exp1 thru Exp10 }      Exp1         : Mnu_Str;
  523.                                 Exp2         : Mnu_Str;
  524.                                 Exp3         : Mnu_Str;
  525.                                 Exp4         : Mnu_Str;
  526.                                 Exp5         : Mnu_Str;
  527.                                 Exp6         : Mnu_Str;
  528.                                 Exp7         : Mnu_Str;
  529.                                 Exp8         : Mnu_Str;
  530.                                 Exp9         : Mnu_Str;
  531.                                 Exp10        : Mnu_Str )  : integer;
  532. {  See the Remarks section of procedure BoxMenuSelect for details        }
  533. begin  {  BoxMenu  }
  534.  
  535. {  Save current screen image }
  536.   Push_Screen( Screen_Stack_Top );
  537.  
  538. {  Display the BoxMenu  }
  539.   BoxMenuDisplay(  Mnu_Column, Mnu_Line, Mnu_Width,
  540.                    Mnu_ItemCtr, Mnu_ForeColor, Mnu_BackColor );
  541.  
  542.   BoxMenu := BoxMenuSelect( Mnu_Column, Mnu_Line, Mnu_Width,
  543.                             Mnu_ItemCtr,
  544.                             Mnu_ForeColor, Mnu_BackColor,
  545.                             Mnu_FldColor, Mnu_HiLite,
  546.                             Mnu_Title, Mnu_Code, Mnu_Select,
  547.                             Exp1, Exp2, Exp3, Exp4, Exp5,
  548.                             Exp6, Exp7, Exp8, Exp9, Exp10 );
  549.  
  550. {  Restore current screen image  }
  551.   Pop_Screen( Screen_Stack_Top );
  552.  
  553. end;   {  BoxMenu  }
  554.  
  555.  
  556.  
  557.  
  558. {----------------------------------------------------------------------}
  559. {           BoxString --- Display and Select Menu Choice               }
  560. {----------------------------------------------------------------------}
  561.  
  562. function BoxString(
  563. { ULC = Upper Left Corner }
  564. { Pos for ULC of menu     }     Mnu_Column   : byte;
  565. { Line # for ULC of menu  }     Mnu_Line     : byte;
  566. { Width of menu           }     Mnu_Width    : byte;
  567.  
  568. { No. of lines in menu    }     Mnu_ItemCtr  : byte;
  569.  
  570. { Foreground text color     }   Mnu_ForeColor: byte;
  571. { BackGround color          }   Mnu_BackColor: byte;
  572.  
  573. { Color for the Menu Fields }   Mnu_FldColor : byte;
  574. { the menu title            }   Mnu_Title    : Mnu_Str;
  575.  
  576. { String Passed to Routine  }   Mnu_Default  : Mnu_Str;
  577. { force Upper Case          }   Mnu_Case     : Char;
  578.  
  579. { Position for Prompt       }   Mnu_InPos    : byte;
  580. { Number for Prompt         }   Mnu_InLine   : byte;
  581. { Length of Input           }   Mnu_BufLen   : byte  )  : Mnu_Str;
  582.  
  583. begin  {  BoxString  }
  584.  
  585. {  Save current screen image }
  586.   Push_Screen( Screen_Stack_Top );
  587.  
  588. {  Display the BoxString  }
  589.   BoxMenuDisplay(  Mnu_Column, Mnu_Line, Mnu_Width,
  590.                    Mnu_ItemCtr, Mnu_ForeColor, Mnu_BackColor );
  591.  
  592.   BoxString := BoxStringRead( Mnu_Column, Mnu_Line, Mnu_Width,
  593.                             Mnu_ItemCtr,
  594.                             Mnu_ForeColor, Mnu_BackColor,
  595.                             Mnu_FldColor,
  596.                             Mnu_Title,
  597.                             Mnu_Default,
  598.                             Mnu_Case,
  599.                             Mnu_InPos, Mnu_InLine,Mnu_Buflen );
  600.  
  601. {  Restore current screen image  }
  602.   Pop_Screen( Screen_Stack_Top );
  603.  
  604. end;   {  BoxString  }
  605.  
  606.  
  607. 
  608.