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