03-15-2016 01:44 AM
Hello,
just a short question about the KEYPRESS events.
I have a STRING on the UI in HOT mode. After the input of a UserName the operator should press the ENTER key.
I use a switch case block to catch the KEYPRESS events :
//---------------------------------------------------------------------------------------------------
int virtualKey;
switch (event)
{
case EVENT_KEYPRESS:
virtualKey = eventData1 & VAL_VKEY_MASK;
if(virtualKey == VAL_ENTER_VKEY) // ist pressed key the 'ENTER' key
{
SetActiveCtrl(inputsHandle, INPUTS_NUM_ARTICLE_NO);
}
break;
}
//---------------------------------------------------------------------------------------------------
I set a breakpoint on the 'virtualKey = ..' line. All keys i try do generate
a KEYPRESS event and the code stops on the breakpoint
except the ENTER key :-O. The ENTER key does not generate the KEYPRESS event !
Anyone has an idea ?
03-15-2016 02:03 AM
additional :
The code block is inside the CALLBACK of the STRING ...
03-15-2016 03:00 AM
Strange enough! I do see all keypress events generated, including for the Entre key, bot with your code and with the more recent GetKeyPressEventVirtualKey instruction [ GetKeyPressEventVirtualKey (eventData2) ]. There must be something in your app that prevents event from being generated.
I suggest you look at userint\events.prj example that shows all events generated on various controls, including a string and a text box control.
03-15-2016 03:50 AM
O.K.
You are right .... it works in a test project .... 😐
It's a software from a colleague that i have to work on.
Is is possible to block the ENTER key ?
Lutz
03-15-2016 04:01 AM - edited 03-15-2016 04:09 AM
The problem is solved .... it's sitting in front of the monitor
There is a button with 'ENTER' as a shortcut key on the UI ..........
Thanks for the help 🙂
03-15-2016 04:06 AM - edited 03-15-2016 04:08 AM
There isn't an easy way that comes to my mind now.
You could see if some callback is chained to the control (ChainCtrlCallback).
In any case, on enter key you should also receive a commit event and use it in your code.
EDIT I see you've solved the problem
The simplest solution is often the most difficult to catch!