home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / toolkid / getline.dem < prev    next >
Encoding:
Text File  |  1980-01-01  |  1.3 KB  |  31 lines

  1. PROGRAM GETLINE_DEMO;
  2. USES IOSTUFF,GETLINE,CRT;
  3. VAR
  4.    TempStr : AnyStr;
  5.    Ch      : Char;
  6. BEGIN
  7.    ClrScr;
  8.    WriteSt('Function GetStr reads a string off the screen.    ',5,7);
  9.    WriteSt('A default string is written on the screen which   ',5,8);
  10.    WriteSt('may be edited by the user.  If the user types     ',5,9);
  11.    WriteSt('a character first, the routine assumes the user   ',5,10);
  12.    WriteSt('wants to input an entire new string.  If he first ',5,11);
  13.    WriteSt('uses editing keys (backspace or left arrow)  the  ',5,12);
  14.    WriteSt('routine assumes he wants to edit the default.     ',5,13);
  15.    WriteSt('The ins, backspace, del, home and end keys work.  ',5,14);
  16.    WriteSt('Field: ',5,5);
  17.    SetColor(Black,LightGray);
  18.    WriteSt('                    ',13,5);
  19.    TempStr := 'Some Stuff';           { Set default string }
  20.    Repeat
  21.       SetColor(Black,LightGray);
  22.       TempStr := GetStr(13,5,20,TempStr);   { Read string at location     }
  23.                                             { 13,5 length 20 with default }
  24.                                             { set initially to TempStr    }
  25.       If TempStr = '' then exit;        { nul string returned on escape key }
  26.       SetColor(Cyan,Black);
  27.       WriteSt('You entered ['+TempStr+']  Do it again ?',5,25);
  28.       Clreol;
  29.       Ch := ReadKey;
  30.    Until Ch in ['n','N'];
  31. END.