LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving the Cursor back to the Top of the Standard I/O window

Is there a way of Moving the Cursor back to the Top of the Standard I/O window ?

I have tried using the ANSI.SYS escape sequences with printf or FmtOut.
ie

char esc = 27; /* escape character */
#define cursorhome "[0H" /* send the cursor home */
printf("%c%s",esc,cursorhome); prints [0H on the screen
0 Kudos
Message 1 of 7
(4,015 Views)
Set the focus to the appropriate window and use the fakekeystroke command. Have'nt actulally tried it thou!
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 7
(3,987 Views)
According to Microsoft Support:
"ANSI.SYS can be loaded and used from the command prompt, with the restriction that it can run only in the context of the MS-DOS subsystem. Windows NT does not support ANSI escape sequences in Win32 Console applications." This would apply also to later versions of Windows.

Check this article.

Regards,
Colin.
0 Kudos
Message 3 of 7
(3,968 Views)
Hi,
if you don't mind clearing out the data you have, then from utility.h there's always Cls();
In Turbo C (shows how far back I go) there used to be a conio.h header which had text management stuff in it, such as setting the cursor position, but with the invention of Windows, the need for this pretty much dissappears, also LabWindows CVI is an ANSI C compiler. Conio.h is not part of ANSI C so it isn't provided with CVI. (It is provided with Visual C++ though so if you really needed to, then write a DLL in VC++ and call that to do your stdio writes, reads and clears / moves.)

Depending on what you're actually trying to do with the stdio window, it would probably be just as easy to run up a panel with a textbox that you can write to instead.

Hope that helps

Sacha Emery
National Instruments (UK)
// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 4 of 7
(3,946 Views)
Many thanks for all of your help.

I tried the fakekeystroke but this did not work. It does look like that windows 2000 does not support ANSI escape sequences.

I did not want to use a test box as this involves a uir and header files which meant it had to be documented and put through the quality loop. A one line FmtOut is all I wanted in my code for debugging my program, and then a cursor home command, to rewrite the page. This allows me a page of scrolling info in the Standard I/O window. I use keyhit to get me out.

I am currently adding a one second delay before clearing the screen, which does give me almost what I want although not ideal.
0 Kudos
Message 5 of 7
(3,925 Views)
Hi Paul.

You don't need a uir or header file to do what you need; you can create the UI elements programmatically, using NewPanel() and NewCtrl().

Then call SetCtrlAttribute() multiple times to set the text box width, number of lines, scroll bar visibility, word wrap mode etc. Use SetCtrlVal() to append text, and ResetTextBox() to empty the box.

Call DiscardPanel() when you're done.

Regards,
Colin.
0 Kudos
Message 6 of 7
(3,909 Views)
In doing what Colin suggest, the UI to code converter can help you.
Build the panel you need in the UIR editor and run the tool: it will create a source file with all the functions needed to recreate programmatically the same panel. After the tool has run the panel can be deleted from the UIR.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(3,899 Views)