LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Ignore Paste shortcut (Ctrl+V)

I’m trying to stop users from pasting into a String Control for validation purposes. I have an EVENT_KEYPRESS within the callback. This event doesn’t catch the Paste Shortcut (Ctrl+V). Any ideas would be much appreciated.
0 Kudos
Message 1 of 2
(3,046 Views)
The Paste (Ctrl+V) command can be trapped under the EVENT_VAL_CHANGED case.

You could track if there has been a keypress event (that implies some manual modification on the control) and swallow the val_changed event not preceded by such type of user operation on the control (keypress is fired before the val_changed event).

In event_keypress case you could raise a flag in case of an alphanumeric character an test the value of the flag in the event_val_changed case. The flag should be reset on event_got_focus.


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 2 of 2
(3,046 Views)