Recent

Author Topic: [SOLVED] console app window control  (Read 601 times)

senglit

  • Full Member
  • ***
  • Posts: 131
[SOLVED] console app window control
« on: October 01, 2023, 07:07:53 am »
Hi all,

I'm working with a console app(mainly on linux. sometimes I also do debug on win10). There is a TCustomApplication working as the main thread and some other TThreads as child threads.

I hope to mange the console window to show some information and accept user input as the attached pic shows:
Zone1. to show the working state of each thread
Zone2. to show some key variables of the app
Zone3. accept user's input

I don't know how to do it. Is there any simple solution?
« Last Edit: October 01, 2023, 12:22:51 pm by senglit »
I use Win10 + Lazarus 2.2.0 + FPC 3.2.2. All 64bit.

TRon

  • Hero Member
  • *****
  • Posts: 3646
Re: console app window control
« Reply #1 on: October 01, 2023, 07:46:29 am »
I don't know how to do it. Is there any simple solution?
If you do not wish to make use of FreeVision then the simplest solution is to use ansi escape sequences, for example with bash here. You use write(ln's) to write such a sequence to the terminal in order to f.e. position the cursor.

Try to stay away from unit crt (though it is properly documented and fairly easy to use) as it exist only for backwards compatibility.

There are probably other Pascal headers/wrappers available for other libs such as ncurses but I am not really familiar with them.
« Last Edit: October 01, 2023, 07:56:28 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

senglit

  • Full Member
  • ***
  • Posts: 131
Re: console app window control
« Reply #2 on: October 01, 2023, 12:21:57 pm »
Thanks a lot! I took a quick look at FreeVision and Ansi Escape Sequences and know they are what I need.


If you do not wish to make use of FreeVision then the simplest solution is to use ansi escape sequences, for example with bash here. You use write(ln's) to write such a sequence to the terminal in order to f.e. position the cursor.

Try to stay away from unit crt (though it is properly documented and fairly easy to use) as it exist only for backwards compatibility.

There are probably other Pascal headers/wrappers available for other libs such as ncurses but I am not really familiar with them.
I use Win10 + Lazarus 2.2.0 + FPC 3.2.2. All 64bit.

 

TinyPortal © 2005-2018