05-25-2014 12:48 AM
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
05-25-2014 12:33 PM
You could consider using ClipboardGetTableVals and ClipboardPutTableVals
05-25-2014 11:10 PM
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
05-26-2014 02:23 AM - edited 05-26-2014 02:24 AM
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.