LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to avoid Space bar generates the commit event

I am using LabWindows/CVI Version 6.0.

The EVENT_COMMIT is generated when user press the <Enter> or <Space> if the active control is a command button.

My question is : is it possible to prohibit the Space bar generating the commit event in this case?

0 Kudos
Message 1 of 3
(3,134 Views)

Hello,

You should catch the keypress using the EVENT_KEYPRESS event in the callback function of the control. Check if the keypress is <Enter> or <Space> and if so, swallow the keypress using the SetKeyPressEventKey function:

  case EVENT_KEYPRESS:
   if (GetKeyPressEventVirtualKey (eventData2) == VAL_ENTER_VKEY ||
      GetKeyPressEventCharacter (eventData2) == ' ')
    SetKeyPressEventKey (eventData2, 0, 0, 0, 0, 0);
   break;

Hope this can help you further.

0 Kudos
Message 2 of 3
(3,130 Views)
It works fine. Thank you very much.
0 Kudos
Message 3 of 3
(3,124 Views)