tbone
2007-05-17 00:50:02 UTC
hmm... all the Delphi groups but this one are essentially silent.
Doesn't anyone use Delphi anymore?
I've been given a Delphi 4 project, and I'm new to Delphi (I used to
know Pascal). This program has many quirks, one of which is prompting
the user at one point to "press any key" (it's a console app and this
is after an error message at startup).
The Read procedure is used to read one character from the keyboard.
Trouble is, you can type any character you want, but the only thing
that works is the Enter key or control-C.
The help says that if you use Read with a Char var, it reads one
character, whereas with a string var, it reads up to a newline. My
experience here seems to indicate that it doesn't matter - it still
waits for a newline.
To wit: ----------------
procedure ShowHelp;
var aKey: char;
begin
writeln;
writeln;
... help messages displayed with writelns ...
writeln('Press any key...');
read(aKey); { doesn't return until you hit Enter}
{keys are echoed in console window }
end;
Any pointers? I know Delphi 4 is ancient but I don't have
authorization to upgrade to anything newer (yet).
Thanks
tbone
Doesn't anyone use Delphi anymore?
I've been given a Delphi 4 project, and I'm new to Delphi (I used to
know Pascal). This program has many quirks, one of which is prompting
the user at one point to "press any key" (it's a console app and this
is after an error message at startup).
The Read procedure is used to read one character from the keyboard.
Trouble is, you can type any character you want, but the only thing
that works is the Enter key or control-C.
The help says that if you use Read with a Char var, it reads one
character, whereas with a string var, it reads up to a newline. My
experience here seems to indicate that it doesn't matter - it still
waits for a newline.
To wit: ----------------
procedure ShowHelp;
var aKey: char;
begin
writeln;
writeln;
... help messages displayed with writelns ...
writeln('Press any key...');
read(aKey); { doesn't return until you hit Enter}
{keys are echoed in console window }
end;
Any pointers? I know Delphi 4 is ancient but I don't have
authorization to upgrade to anything newer (yet).
Thanks
tbone