Jens borrisholt
Thursday 30th July 2020, 07:34
A better connsole
I stumpled over your basic Console toturinal
http://www.festra.com/eng/mtut10.htm
The problem with Console applications, in Delphi, are that they are very low-level and if you want to do just simple things, like clearing the screen og changing the text color you have to do i all by hand.
That why I wrote Delphi Console.. To make things simple
Have a look at this demo:
program Project51;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils, System.Console;
begin
try
Console.CursorVisible := False;
Console.ForegroundColor := TConsoleColor.DarkBlue;
Console.WriteLine('Hello form the blue World');
Console.WriteLine;
Console.BackgroundColor := TConsoleColor.White;
Console.WriteLine('Hello from the blue and white World');
Console.WriteLine;
Console.ForegroundColor := TConsoleColor.White;
Console.BackgroundColor := TConsoleColor.Black;
Console.Write('Pres any key to clear the screen...');
Console.ReadLine;
Console.Clear;
Console.ForegroundColor := TConsoleColor.Gray;
Console.WriteLine('Hello from the gray World');
Console.WriteLine;
Console.WriteLine('Pres any key to exit..');
Console.ReadLine;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Simple and clean code like we know Delphi
You'll finde Delphi console at GitHUB:
https://github.com/JensBorrisholt/DelphiConsole