home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST1005.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-31  |  2.1 KB  |  48 lines

  1. Program TestGrafReadUnit;
  2. {--------------------------------------------------------------}
  3. { This program is just a simple driver to test the GrafRead    }
  4. { Unit.  It will call the ReadString procedure while in both   }
  5. { Text and graphics modes.  It uses one of the stroked fonts   }
  6. { while in graphics mode.                                      }
  7. {--------------------------------------------------------------}
  8.  
  9. Uses Crt, Graph, GrafRead; { Link the necessary units          }
  10.  
  11. Const
  12.   PathToDrivers = '';      { Location of the support files     }
  13.  
  14. Var
  15.   GraphDriver,
  16.   GraphMode : Integer;     { Graph Driver and Mode             }
  17.   Ch : Char;               { Pausing character                 }
  18.   InputString : String;    { String to be inputted             }
  19.   C : Word;                { Temporary calculation variable    }
  20.  
  21.  
  22. Begin
  23.   GraphDriver := Detect;
  24.   FillChar( InputString, SizeOf( InputString ), #0 );
  25.                            { Initialize string and driver vars }
  26.   InitGraph( GraphDriver, GraphMode, PathToDrivers );
  27.   SetTextStyle( TriplexFont, HorizDir, 2 );
  28.   SetBKColor( Blue );      { Use other background than black   }
  29.   GraphicsMode := True;    { Indicate we are in graphics mode  }
  30.   Rectangle( 0,0,GetMaxX,GetMaxY );
  31.   MoveTo( 5,5 );           { Frame the screen, replace pointer }
  32.   OutText( 'Enter a String: ' );
  33.                            { Prompt user for input             }
  34.   ReadString( InputString );
  35.                            { Read the string                   }
  36.   C := GetMaxY - TextHeight( 'W' ) - 5;
  37.   OutTextXY( 5, C, InputString );
  38.   Ch := Readkey;           { Echo the string to differnt loc   }
  39.   GraphicsMode := False;
  40.   CloseGraph;              { Shut down the graphics mode       }
  41.   Writeln( 'InputString = ', InputString );
  42.                            { Echo the string in text mode      }
  43.   ReadString( InputString );{ Read the string                  }
  44.   Writeln( 'InputString now = ', InputString );
  45.                            { Echo the string back to the screen}
  46.   Readln;                  { Pause to view the output          }
  47. End.
  48.