LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Key navigation changes mechanical action

Hi,
I have a boolean control with the mechanical action set to 'switch until released'. It works fine when pressed with mouse. Now, I have assigned a key say 'enter' using key navigation from the advanced menu. When I press the enter button, the control remains in the ON position instead of reverting to original position. Please help me out with this.
Regards,
Giridhar Rajan
Automation Engineer
Cruiser Controls
Mumbai, India
0 Kudos
Message 1 of 30
(5,504 Views)

Dear Giriraj,

           Here is your solution, put ur mechenical action to the Latch when released and see, ithink thats wat u want?? i ve attached the vi.

            if it isnt, com back to me...

Thanks,

Nishant

0 Kudos
Message 2 of 30
(5,493 Views)
Hi Nishant,
 
Thanks for your reply. I'm using local variables of that boolean variable and hence the mechanical action 'latch' is not compatible with them and shows error.
 
Regards,
Giridhar Rajan
Automation Engineer
Cruiser Controls
Mumbai, India
0 Kudos
Message 3 of 30
(5,463 Views)
Post your code so we can see exactly how you're doing this.

___________________
Try to take over the world!
Message 4 of 30
(5,455 Views)

Tried to do what you are doing (set boolean to 'switch until released' and assign key ) and observed the same

since yesterday, I did try some logics to make 'switch until released'  happen with a keyboard sync , but none came upto my own satisfaction

so, as tst has already suggested, post your code and we may to think of a workaround for achieving what you want to

Regards

Dev

 

Message Edited by devchander on 12-23-2005 05:58 AM

Message Edited by devchander on 12-23-2005 06:00 AM

0 Kudos
Message 5 of 30
(5,451 Views)

Hi Giridhar,

The mechanical action of switch when selected as 'switch until released' Keeps the boolean ON till you keep the mouse's  left click 'pressed'.

In other words, It goes ON when u press the click button and returns to OFF when u release the click button of the mouse.( so you do two events- press and release)

When you assign a key for it, pressing once is equivalent to pressing the left click on your mouse.

So you have to hit the same key again to initiate the release action.

You might not be happy with this kind of switching once you assign a key to the boolean, but i guess this is how this option works.

regards

Dev

 

 

Message Edited by devchander on 12-23-2005 06:24 AM

Message 6 of 30
(5,446 Views)

Hi all,

Thanks for your valuable suggestions. Can someone tell me how can I read keystrokes in labview. For example, if I press the <enter> button in the keyboard, how can labview get to know that <enter> has been pressed. If I can get the status of the enter key, then I can implement a switch untill pressed mechanical action using case structures by making it switch to true and then immediately back to false. My code is at customer site and hence cant be brought to the discussion forum. Thanks again.

Regards,

Giridhar Rajan

Automation Engineer

Cruiser Controls

Mumbai, India

0 Kudos
Message 7 of 30
(5,434 Views)

Hi Giridhar,

Ok, that is quite easy.

This VI should do the Job

Modify and use it in your VI for realising your logic.

Regards

Dev

 

Message Edited by devchander on 12-23-2005 10:47 PM

Message 8 of 30
(5,429 Views)
Message 9 of 30
(5,425 Views)

Dev's method is very general and is only recommended if you really have to read the keyboard in every situation (for example, if your application window isn't in focus). Usually, the simple, more elegant, approach would be using the event structure, as you can see in the attached example. Event driven programming is a very powerful tool and you can search for tutorials on the site and for exampls to see more on how to use it.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
Message 10 of 30
(5,291 Views)