LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

protection key

Hi,

I want to use a protection key + left mouse to enable some buttons. for example, there is a button on the interface, usually, the button is disabled. If the user want to take a action on this button, they have to press "Shift" key (enable button) and click this button.
I saw some examples to use short-key, but my quesiton is some different. Is there anyone know how to implement this function, thank you.

NNQ
0 Kudos
Message 1 of 6
(2,595 Views)

This shows how to use the KeyDown? event to capture the scan code of which key was pressed.  The scan code for the left shift key is 42.  When pressed, the OK button becomes enabled.  Any other key press will disable the OK button.

Message Edited by tbob on 02-28-2006 02:03 PM

- tbob

Inventor of the WORM Global
Message 2 of 6
(2,578 Views)
Here's a version that will only enable the OK button while you hold down the shift key.  Releasing the shift key disables the OK button again.
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
Message 3 of 6
(2,569 Views)
Thank you so much. I noticed you are using event handling. Is this possible to implement it in Labview 5.1?

Thanks
0 Kudos
Message 4 of 6
(2,556 Views)


@NN Q wrote:
Thank you so much. I noticed you are using event handling. Is this possible to implement it in Labview 5.1?

Thanks



No.  Event structures were introduced in LV 6 or 7.  Definitely not in 5.1.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 6
(2,544 Views)
Hi NNQ,
        There may be a native LabVIEW 5.1 function that you can use.  But after reading your post I scanned through the "Get" functions in User32.llb and found "GetKeyState".  I'm pretty sure you can determine whether the Shift-key is pressed using this function.  The Windows API exposes a wealth of interesting functions - including some Mouse related.
 
Cheers
 

Message Edited by Dynamik on 03-01-2006 12:59 AM

Message Edited by Dynamik on 03-01-2006 01:01 AM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 6 of 6
(2,539 Views)