09-23-2010 11:32 PM
Hey all,
I am trying to accept some keys from the user and hence using the GetKey() command as follows:
char letter;
letter = GetKey ();
SetStdioWindowVisibility(0);
So I am trying to accept a key and then hide the I/O console. But SetStdioWindowVisibility(0) is not hiding it. It still stays there.
So I tried playing around and found that having a printf or FmtOut either before or after the GetKey() did the job. That is,
//printf or FmtOut before GetKey()
char letter;
printf ("\n");
letter = GetKey ();
SetStdioWindowVisibility(0);
or
//printf or FmtOut after GetKey()
char letter;
letter = GetKey ();
SetStdioWindowVisibility(0);
printf ("\n");
Another solution is to change the console to "CVI Studio Window" also does the job.
SetStdioPort (CVI_STDIO_WINDOW);
char letter;
letter = GetKey ();
SetStdioWindowVisibility(0);
I checked and saw that the default option, if we do not do SetStdioPort(), is "Host System's Stdio".
So can someone explain why SetStdioWindowVisibility(0) does not work without the printf or FmtOut()
Thanks in advance! 🙂
09-24-2010 12:06 PM
Shailesh:
What version of CVI are you using? I didn't have any problem using SetStdioWindowVisibility() to hide or display either stdio window in eother CVI 6.0 or 9.0.1.
Here's the simple code I tested.
#include <utility.h>
main()
{
char letter;
SetStdioPort (HOST_SYSTEM_STDIO);
letter = GetKey ();
SetStdioWindowVisibility(0);
Delay(1);
SetStdioWindowVisibility(1);
Delay(1);
SetStdioWindowVisibility(0);
Delay(1);
SetStdioPort (CVI_STDIO_WINDOW);
letter = GetKey ();
SetStdioWindowVisibility(0);
Delay(1);
SetStdioWindowVisibility(1);
Delay(1);
SetStdioWindowVisibility(0);
Delay(1);
}
If you search this forum for SetStdioWindowVisibility, you'll find that other people have had problem with SetStdioWindowVisibility.
Look at this post, where I suggested moving the window off screen.
http://forums.ni.com/t5/LabWindows-CVI/How-to-Close-Standard-IO-Window/m-p/978009
Why are you using the stdio window to get user input? Why not have a user interface created with the UI editor and have a text box or string control for user entry? Or use a PromptPopup, if you don't want to use a UIR?
09-24-2010 02:32 PM - edited 09-24-2010 02:41 PM
09-24-2010 02:43 PM