LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Cut and Paste with Password Control

If you paste (ctrl-v) information into a "Password Control" field from the 'toolslib' the text is not masked with the desired character.
Pressing 'Enter' with pasted text results in no entry.

Is there a way to modify this behavior?
0 Kudos
Message 1 of 4
(3,204 Views)
Hi,

you are right, looks like the control does not behave correctly when the data is pasted to the control. I'll submit a report on this. In the mean time, you can modify the code to take into account this special case. You can find the code at C:\Program Files\National Instruments\CVI70\toolslib\custctrl\pwctrl.c

Another option is to create a callback for the control and catch the keyboard events; check if the user pasted something and probably swalow the event by returning a non-zero value; this should avoid the text to be pasted.

I hope this helps.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 4
(3,204 Views)
I ended up creating a work around by looking for the CONTROL key being pressed using the Windows SDK "GetKeyState(VK_CONTROL)" in the EVENT_VAL_CHANGED case of the controls callback.
Since I had been saving the password as each character had been entered (via EVENT_KEYPRESS) it was easy to catch the CTRL keypress and then write the password back to the control and thus wiping out the "Pasted" text. If I hadn't saved the accumulated password I could have 'ate' the event by returning 1 from the callback (at least I think thats how you eat an event).

I had to use the Windows SDK function because LW/CVI doesn't like you probing for keys with "GetKeypressEventVirtualKey()" in the EVENT_VAL_CHANGED case.

The Paste (ie .. the CTRL-V) key sequence didn't pass thro
ugh the EVENT_KEYPRESS case, only EVENT_VAL_CHANGED.

Since I'm really green; I didn't easily find another LW/CVI function that could capture the CONTROL, SHIFT, MENU or ALT keys being pressed.

Thanks for the help!
0 Kudos
Message 3 of 4
(3,204 Views)
That is a very good workaround. CVI provides the function GetKeyPressEventVirtualKey (eventData2) to check for virtual keys. however using hte SDK function should do just fine.

good luck with your project.

Juan Carlos
0 Kudos
Message 4 of 4
(3,204 Views)