LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to increment continuously while holding mouse click

Solved!
Go to solution

The attached VI increments a count with each mouse click.  Is it possible to increment continuously with the event structure while holding the mouse click?  For example, if I want to increment the count from 1 to 100, I don't want to have to click the mouse 100 times, I just want to click once and hold.

0 Kudos
Message 1 of 5
(4,244 Views)

If you play around with the timeout, this is easy to do.  Use a shift register to hold what the timeout should be.  When the button's value changes to TRUE, set the timeout to something like 200ms.  When it goes to FALSE, set it to -1 (forever).  Increment the value in the Timeout case.  You will also want to change the mechanical action of the button to be Switch Until Released.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(4,236 Views)
Solution
Accepted by topic author VI_Joe

Here's a slightly simpler version that eliminates some duplicate code.

 

(Note that Tim and me both placed the indicator before the event structure. This eliminates the need for the reset operation.)

Message 3 of 5
(4,222 Views)

I changed altenbach's VI just a bit so that when you press increment it waits a certain amount of time (500ms in this case) before it starts increasing automatically.  This can prevent a double increment if you do not release the button quick enough.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 5
(4,197 Views)

@Jacobson-ni wrote:

I changed altenbach's VI just a bit ...


... except that you posted in LabVIEW 2014, which the OP probably cannot open.

0 Kudos
Message 5 of 5
(4,189 Views)