LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

If the table cell can not receive a virtual key?

Hello,

 

Want to execuate a "copy/paste" function in the table control. I hope type the "Ctrl+c" to copy  text in a cell, but nothing to do with the "ctrl" key pressed.

 

David

0 Kudos
Message 1 of 4
(4,464 Views)

You could consider using ClipboardGetTableVals and ClipboardPutTableVals



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 2 of 4
(4,440 Views)

Hi Roberto,

 

The key problem is how to capture the virtual key pressed event in a table. e.g., how to capture the "Ctrl+c" or "Ctrl +v" in the EVENT_KEYPRESS case?

 

 

David

0 Kudos
Message 3 of 4
(4,432 Views)

Table can receive and trap Ctrl + someCharacter in keypress event: you can discriminate the keys pressed with this code:

if (event == EVENT_KEYPRESS) {
  if (GetKeyPressEventModifiers (eventData2) == VAL_MENUKEY_MODIFIER) {
    sprintf (msg, "Ctrl + %c pressed.", GetKeyPressEventCharacter (eventData2));
    MessagePopup ("Notice", msg);
  }
}
else if (event == EVENT_VAL_CHANGED)
  MessagePopup ("Notice", "Cell value changed.");

 

Unfortunately, if the table is in edit mode Ctrl-C and Ctrl+V appear to be trapped by the system at low level and not to be passed to the control callback. Within CVI you can trap EVENT_VAL_CHANGED event, but I see no way to discriminate between a user type-in and a paste operation except for trapping whether a previous keypress event was received, which can be a troubled way to go. I can't see a way to trap Ctrl+C.

There may be a method to get those event using some windows API but I don't know it.



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 4 of 4
(4,411 Views)