home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 24b / machinfo.zip / BOX.TUR next >
Text File  |  1986-04-27  |  3KB  |  128 lines

  1. { BOX.TUR
  2.  
  3.   By:  Drew O. Letcher
  4.        Iowa City, IA
  5.        April, 1986
  6. }
  7.  
  8. TYPE
  9.    str72 = string[ 72 ];
  10.  
  11. {typed} CONST
  12.    { global window coordinates }
  13.    W1 : byte = 1;
  14.    W2 : byte = 1;
  15.    W3 : byte = 80;
  16.    W4 : byte = 25;
  17.  
  18. PROCEDURE  Box( LeftColumn, TopRow, RightColumn, BottomRow  :  integer;
  19.                 Title  :  str72  );
  20.  
  21. {  This procedure creates a box.  Then it creates a window inside the box and
  22.    clears the window.
  23.    The title is automatically centered in the middle of the top line, it is
  24.    the programmers responsiblity to make sure the title will fit.
  25.    Box dimensions are relative to the full screen.  The window dimensions are
  26.    saved in the global variables W1, W2, W3, W4.
  27.  
  28.    NOTE:  Needs the include file CharAttr.tur.
  29. }
  30.  
  31.    VAR
  32.       Column,
  33.       Row      :  integer;
  34.  
  35.    BEGIN
  36.       Window( 1,1, 80,25 );
  37.       HighIntensity;
  38.  
  39.       {  upper left corner  }
  40.       GotoXY( LeftColumn, TopRow );
  41.       write( '╓' );
  42.  
  43.       { top line & title }
  44.       FOR Column := 1 TO
  45.           Round( ( RightColumn - LeftColumn - Length( Title ) - 7 ) / 2 )  DO
  46.          write( '─' );
  47.  
  48.       Write( '┤' );
  49.       LowIntensity;
  50.       ReverseVideo;
  51.       Write( '  ', Title, '  ' );
  52.       HighIntensity;
  53.       Write( '├' );
  54.  
  55.       FOR Column := 1 TO
  56.           ( RightColumn - LeftColumn - Length( Title ) - 7 ) DIV 2 DO
  57.          write( '─' );
  58.  
  59.       {  upper right corner  }
  60.       write( '╖' );
  61.  
  62.       {  left side  }
  63.       FOR Row := ( TopRow + 1 ) TO ( BottomRow - 1 ) DO
  64.          BEGIN
  65.          GotoXY( LeftColumn, Row );
  66.          write( '║' )
  67.          END;
  68.  
  69.       {  right side  }
  70.       FOR Row := ( TopRow + 1 ) TO ( BottomRow - 1 ) DO
  71.          BEGIN
  72.          GotoXY( RightColumn, Row );
  73.          write( '║' )
  74.          END;
  75.  
  76.       {  lower left corner  }
  77.       GotoXY( LeftColumn, BottomRow );
  78.       write( '╙' );
  79.  
  80.       {  bottom  }
  81.       FOR Column := ( LeftColumn + 1 ) TO ( RightColumn - 1 ) DO
  82.          write( '─' );
  83.  
  84.       {  lower right corner  }
  85.       write( '╜' );
  86.  
  87.       {  create and clear the window   }
  88.       W1 := LeftColumn + 1;
  89.       W2 := TopRow + 1;
  90.       W3 := RightColumn - 1;
  91.       W4 := BottomRow - 1;
  92.       Window( W1, W2, W3, W4 );
  93.       ClrScr;
  94.  
  95.    END;  {  **  Procedure Box3 **  }
  96.  
  97.  
  98.  
  99. PROCEDURE  Instruction(  Line  :  str72  );
  100. { Displays a string in reverse video on the top line of the screen and returns
  101.   the window to ( W1,W2, W3,W4 ) and replaces the cursor.
  102. }
  103.  
  104.    VAR
  105.       X,Y  :  byte;
  106.  
  107.    BEGIN
  108.  
  109.    X := WhereX;
  110.    Y := WhereY;
  111.  
  112.    Window( 1,1, 80,25 );
  113.    GotoXY( 1,1 );
  114.  
  115.    LowIntensity;
  116.    ReverseVideo;
  117.    ClrEOL;
  118.    Write( Line );
  119.  
  120.    HighIntensity;
  121.    Window( W1,W2, W3,W4 );
  122.    GotoXY( X,Y );
  123.  
  124.    END;  { **  Procedure Instruction  ** }
  125.  
  126.  
  127.  
  128.