Active Forums => QB64 Discussion => Topic started by: hanness on April 20, 2021, 09:28:31 am
Title: Is there a way to set a scrolling region on console output?
Post by: hanness on April 20, 2021, 09:28:31 am
As an example, I have a program that runs a lot of Windows command line utilities using SHELL and displays the output in a console. Let's assume that we are copying a lot of files using Robocopy and the output is being displayed to the screen. I would like to have the output displayed to the screen and the information scroll up and off the screen just as if the command was run manually at a command prompt, but with one exception: I would like to have a couple of static lines of information at the bottom of the screen that don't get affected by the region that is scrolling.
Is anyone aware of a way to accomplish something like that using QB64
Title: Re: Is there a way to set a scrolling region on console output?
Post by: Cobalt on April 20, 2021, 11:06:18 am
I believe it is VIEW PRINT, though I do not know if that works in console. http://www.qb64.org/wiki/VIEW_PRINT
Title: Re: Is there a way to set a scrolling region on console output?
Post by: hanness on April 20, 2021, 11:27:16 am
Thanks very much for pointing me to that. You are right, it doesn't seem to apply to a console window, at least it didn't work in the quick test I did so far. This may still help me anyway, so thanks again.
Title: Re: Is there a way to set a scrolling region on console output?
Post by: visionmercer on April 20, 2021, 03:12:34 pm
If you are using Windows 8 or later you can use escape codes.
Writing this i found that if there is not a CLS it will not work in cmd.exe. it will work in windows terminal without CLS but the width command is not functioning there.
A list of escape codes that is supported in windows: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences (https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences)
Title: Re: Is there a way to set a scrolling region on console output?
Post by: JohnUKresults on April 21, 2021, 12:21:35 pm
Hi
I use the view print commands in my program. Ignore the various variables shown, but the Head.Statusline prints various things at the top of the QB64 window by calling Window.High and then the Window.Low sub returns the focus to the lower part. I've set my top window as the top 4 lines and the bottom window as lines 5 to 25 (I'm sunning this program in the standard screen 0 or whatever QB64 defaults to). The bottom window can scroll happily with new text. I don't know if it would work the other way round i.e. to fix the lower window for information and scroll the top part.
Sorry if this code isn't copied in correctly - not sure how to do that!