LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

'enter key' generates no KEYPRESS event

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 ?

Lutz Geis
0 Kudos
Message 1 of 6
(5,179 Views)

additional :

 

The code block is inside the CALLBACK of the STRING ...

Lutz Geis
0 Kudos
Message 2 of 6
(5,177 Views)

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.



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?
Message 3 of 6
(5,168 Views)

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

Lutz Geis
0 Kudos
Message 4 of 6
(5,163 Views)

The problem is solved .... it's sitting in front of the monitor Smiley Embarassed

 

There is a button with 'ENTER' as a shortcut key on the UI ..........

 

Thanks for the help 🙂

Lutz Geis
0 Kudos
Message 5 of 6
(5,160 Views)

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 Smiley Happy

The simplest solution is often the most difficult to catch! Smiley Wink



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 6 of 6
(5,158 Views)