Mechanical Action + Keyboard Control 
Author Message
 Mechanical Action + Keyboard Control

Is it possible to set the mechanical action of a button to something
like "switch while key down", i.e. the button returns TRUE as long as
the associated key is pressed?

Regards
Carsten.



Sat, 14 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control
Yes!

Right click the button ...mechanical action.. select: "switch until
released"

The library of online examples has a nice demonstration. It can be found
under: (help ... search examples ... Advanced:customizing controls and VIs
... Boolean mechanical action)

Chris


Quote:
>Is it possible to set the mechanical action of a button to something
>like "switch while key down", i.e. the button returns TRUE as long as
>the associated key is pressed?

>Regards
>Carsten.



Sat, 14 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control
Hi Chris!
The "switch until released" option refers to mouse clicks, not keyboard
events. What I am looking for is a button that follows the state of its
associated key. E.g. press [F8], button changes to TRUE, keep [F8] pressed,
button remains TRUE, release [F8], button changes to FALSE.

Carsten.

Quote:

> Yes!

> Right click the button ...mechanical action.. select: "switch until
> released"

> The library of online examples has a nice demonstration. It can be found
> under: (help ... search examples ... Advanced:customizing controls and VIs
> ... Boolean mechanical action)

> Chris



Sun, 15 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control
Carsten,

There is a keyboard library at:

ftp://ftp.natinst.com/support/labview/windows/vis/3.0/keyboard/

that will allow you to intercept keys from the keyboard and route them to
your vi's.  There is some danger however.  It always routes to your vi even
though you have your favorite word processor as the top most active window.

It was written back on version 3.0 or 3.1 and I don't know if it still works
for version 5.01.  But what do you have to loose.  I used it for a stand
alone app and I think it's still working fine.

The best way to associate the [F8] key is the way that Chris described and
setting the Key Navigation to [F8].  The downside here is that the keyboard
key will toggle the boolean button if you hold the [F8] key down.  The work
around is to create some anti bounce code around the button that would take
this into account.

Live long and be wired.

Bob Hopkins

Quote:

>Hi Chris!
>The "switch until released" option refers to mouse clicks, not keyboard
>events. What I am looking for is a button that follows the state of its
>associated key. E.g. press [F8], button changes to TRUE, keep [F8] pressed,
>button remains TRUE, release [F8], button changes to FALSE.

>Carsten.



Sun, 15 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control

Quote:

>Is it possible to set the mechanical action of a button to something
>like "switch while key down", i.e. the button returns TRUE as long as
>the associated key is pressed?

>Regards
>Carsten.

I have a similar (but different) question:

I have a data acquisition while loop which is fairly slow (2 seconds per
'while'). If a user presses a stop button attached to the while loop, I have
to set the button to latch to get reliable stopping (since the users tend to
press the button and then release it whilst the data acquisition is still
underway). However, once stopped, if the user runs the VI again the button
is still latched, so the VI doesn't run.
Any way round this?

Thanks,

Hywel



Mon, 16 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control

Quote:


> >Is it possible to set the mechanical action of a button to something
> >like "switch while key down", i.e. the button returns TRUE as long as
> >the associated key is pressed?

> >Regards
> >Carsten.

> I have a similar (but different) question:

> I have a data acquisition while loop which is fairly slow (2 seconds per
> 'while'). If a user presses a stop button attached to the while loop, I have
> to set the button to latch to get reliable stopping (since the users tend to
> press the button and then release it whilst the data acquisition is still
> underway). However, once stopped, if the user runs the VI again the button
> is still latched, so the VI doesn't run.
> Any way round this?

> Thanks,

> Hywel

You can set the button to off with a local variable after exiting the
loop !

Regards
Stefan ;-)
--
||   Stefan Tauche   Siemens Semiconductor Group, Muenchen
||  

\\=========(remove NoSpam from address to reply)===========



Mon, 16 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control

Quote:

>I have a data acquisition while loop which is fairly slow (2 seconds per
>'while'). If a user presses a stop button attached to the while loop, I
have
>to set the button to latch to get reliable stopping (since the users tend
to
>press the button and then release it whilst the data acquisition is still
>underway). However, once stopped, if the user runs the VI again the button
>is still latched, so the VI doesn't run.

As I see this problem, I see two separate processes.  One is to scan data at
a 2 second rate and the other is to look for the stop function at perhaps
100 ms rate.  One solution is to create two while loops and connect them
together with an occurrence.  The button process would simply loop and read
the stop function which is set the mechanical action to "latch" and if true
then set the occurrence and also stop that process.  The button will reset
itself back to the false state after the control is read by LV at the
terminal so it is guaranteed to always be false when the vi starts.  The
other data scan process could then use the Wait on Occurrence with the
timeout wired to some small positive value.  The output "timed out" would
then be wired to the while loop termination icon.  If the Wait times out
(true), it means that the button was not pushed and the process goes and
gets more data.  If it is false, it means that the stop button was pushed
and the data scan process will terminate.

Hope this helps
Bob Hopkins



Mon, 16 Jul 2001 03:00:00 GMT  
 Mechanical Action + Keyboard Control
If you set it to any of the "latch" actions, the <T> state will be retained
until the control is read by your diagram, even if you release the button
right away. Thus it will definitely stop less than 2 seconds later. It seems
to me that yours is set to "switch when pressed". Look again at the example
"mechanical action of booleans" mentioned earlier in this thread.

Set your control e.g. to "latch when released" and you VI is guaranteed to
stop with the stop button reset. No need for locals and occurences.

    Cheers

    Christian

Quote:

>I have a data acquisition while loop which is fairly slow (2 seconds per
>'while'). If a user presses a stop button attached to the while loop, I
have
>to set the button to latch to get reliable stopping (since the users tend
to
>press the button and then release it whilst the data acquisition is still
>underway). However, once stopped, if the user runs the VI again the button
>is still latched, so the VI doesn't run.
>Any way round this?

>Thanks,

>Hywel



Mon, 16 Jul 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Help: Setting the mechanical action of a boolean control

2. Mechanical Action of an array of buttons

3. basic software and hardware for designing a control system embebed ina mechanical system

4. Tab and Space Bar action locks true value on Boolean Control

5. Performing actions on control value / state changes

6. action on control click

7. Controlling html action from vrml

8. VA: Keyboard shortcuts for Radio Buttons/Tab Controls

9. control-tab is not a keyboard event?

10. Set keyboard focus for a string control

11. Keyboard manipulation of Digital Control

12. Manually controlling the front panel without a keyboard

 

 
Powered by phpBB® Forum Software