home *** CD-ROM | disk | FTP | other *** search
- Program DemoInputUnit;
-
- Uses
- Crt, InputUn;
-
- var
- InKey : char;
- AnyString : string;
- AnyInt : longint;
- AnyNum : real;
- Escape : boolean;
-
- begin
- ClrScr;
- writeln;
- Inverse;
- writeln(' Text in Inverse mode ');
- writeln;
- Underline;
- writeln(' Text in Underline mode ( if using a monochrome monitor)');
- writeln;
- normal;
- writeln(' Back to normal ');
- writeln;
- writeln(' The GoBack procedure is used...(press any key)................ ');
- Inkey:=readkey;
- goback;
- writeln(' To erase a line and write a new one (press any key) ');
- InKey:=readkey;
- ClrScr;
- writeln(' The ReadString function takes 3 parameters');
- writeln(' Function ReadString( Prompt : string; width : byte; var Escape : boolean )');
- writeln(' : string;');
- writeln(' Prompt is the string that is first put into the edit field.');
- writeln(' This is the string that the function returns if the function is exited with');
- writeln(' an Esc at any time, or a return while it is there.');
- writeln(' This prompt may be edited if the right arrow or the insert key is pressed');
- writeln(' on the first input, otherwise the prompt will disappear. The return key ');
- writeln(' will input all the visible characters in the field and exit the function.');
- writeln(' The Del, left and right arrow keys work as does the backspace.');
- writeln(' The Ins key toggles the insert mode where new characters are inserted ');
- writeln(' instead of written over. It is initially off.');
- writeln(' Esc will also exit the function, return the prompt as the result and set ');
- writeln(' the Escape parameter to true (otherwise set to false with a return');
- writeln(' the width parameter sets the maximum length of the string');
- writeln(' This field is highlighted in Inverse. It may be turned off by setting the');
- writeln(' InverseOn to true. Another Global varible that affects this function is');
- writeln(' ValidCharSet which is initially set to the set of all printable characters.');
- writeln(' You can change it before calling this function, and is reset to the ');
- writeln(' DefaultSet const after calling it. The InverseOn varible will convert');
- writeln(' all letters to uppercase if set to true. It is initially set to false');
- writeln;
- repeat
- write('Input a string->');
- AnyString:=ReadString('This is your prompt',20,escape);
- writeln;
- goback;
- if escape
- then write(' Escape Exit ');
- writeln('Your string is ''',AnyString,'''');
- inkey:=readkey;
- goback;
- write('Input an integer ( ReadInt )->');
- AnyInt:=ReadInt(123,5,Escape);
- writeln;
- goback;
- if escape
- then write(' Escape Exit ');
- writeln('Your integer is ',AnyInt);
- if escape then exit;
- inkey:=readkey;
- goback;
- write('Input a real number ( ReadNum )->');
- AnyNum:=ReadNum(1.23,8,escape);
- writeln;
- goback;
- if escape
- then write(' Escape Exit ');
- writeln('Your Number is ',AnyNum:0:5);
- if escape then exit;
- if not escape
- then begin
- Inkey:=readkey;
- goback;
- end;
- until escape;
- end.
-
-
-
-
-