08-13-2020 04:06 AM
Hello,
I have problem in generating EVENT_KEYPRESS from Shift and Ctrl keys. Other keys generate this event as expected.
Here is code that I used:
CVICALLBACK panelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
if (event == EVENT_CLOSE)
{
QuitUserInterface (0);
}
if(event == EVENT_KEYPRESS)
{
MessagePopup("title", "Some message");
}
return 0;
}
Solved! Go to Solution.
08-13-2020 05:34 PM
You're right: Shift and Ctrl keys don't generate keypress events; nevertheless, in a keypress event you can detect combinations of such keys with ordinary keys (such as Shift-Tab or Ctrl-A) as you can see in samples\userint\multikey.cws example.
On the other hand, if you want to react to simple Shift or Ctrl keys pressing you can use GetGlobalMouseState () function; unfortunately, this function must be continously polled to detect events as it is not possible to install a callback on these events. See samples\userint\moustate.cws example for reference.