I am developing an console application for Linux in RAD Studio 12 Delphi and I would like to be able to catch keyboard input but without waiting for Enter to be pressed.
The behavior is similar to applications such as top
and many others.
In a regular Windows console application, all required function calls could be found in the Winapi.Windows
.
It had advanced console functions such as ReadConsoleInput()
, GetConsoleScreenBufferInfo()
and SetConsoleTextAttribute()
. These allows the program to catch events from the console such as key presses, window focus and add the ability to change the text and background color of the console.
In Lazarus, which is Delphi aswell, there is the crt
unit with all required functions.
But for Linux application development in RAD Studio I cannot find any straight forward way to really do anything more in the console than ReadLn()
and WriteLn()
and few other minor elements.
So, Is there a way to read/catch these events and find alternatives for the Winapi.Windows
functions for Linux Application Development?