cancel
Showing results for 
Search instead for 
Did you mean: 

Ignore Multiple Button Clicks

SOLVED
CodeSDz
Member
Solved!

Ignore Multiple Button Clicks

Message contains an image

My front panel consists of a "Latch when released" button and a numeric indicator.  The [0] "Boolean" Value Change is the only event in the structure.

 

If I click the button twice quickly (within 500ms), a second "Value Change" event queues and executes after the first.  

 

How can I ignore "Value Change" events that occur while executing other events?

 

simple loop.GIF

6 REPLIES 6
Been bitten by LabVIEW
Active Participant

Re: Ignore Multiple Button Clicks

You could try and disabling the control in the event and reenabling it when you are ready to get the next one.

 

Mind you if the event isn't picked up right away, two clicks could still be registered.  To avoid that, you can put in the event case immediately after disabling the control, a loop with an event structure in it that waits on that event and has a timeout of 0.  If it goes thought the timeout, there is no button press so exit the loop.

 

Hope this helps.

 

 

A

Highlighted
jcarmody
Trusted Enthusiast

Re: Ignore Multiple Button Clicks

Message contains an image

You could use the Mouse Down? event and check for a double-click.

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

JackDunaway
Trusted Enthusiast
Solution

Re: Ignore Multiple Button Clicks

Message contains an image

Another option that also adds some UI feedback is to set the Busy Cursor. This prevents clicks, and alerts user that the program is cranking:

 

SetCursorBusy.png

JackDunaway
Trusted Enthusiast

Re: Ignore Multiple Button Clicks


@jcarmody wrote:

You could use the Mouse Down? event and check for a double-click.


Double-click method may or may not be reliable since DC settings are user-specific and typically less than 500msec. Also, I'm guessing the 500msec generally refers to "something that takes a while to crunch", so that threshold is possibly a moving target.

tst
Knight of NI Knight of NI
Knight of NI

Re: Ignore Multiple Button Clicks

A co-worker had a similar problem in a specific project where users were complaining that some screens were not appearing.

 

Some psychic debugging eventually revealed the problem - the users were double clicking the OK button, and the next time the dialog was called, it dutifully executed the second value change event which occured the last time that the dialog was open.

 

I don't remember what the solution we did there was (either educating the users, or a specific solution for those dialogs), but it makes me think that maybe there should be an idea on the idea exchange for a way to globally disable this. I don't have any suitable mechanism, so I have nothing to post yet.


___________________
Try to take over the world!
ian_fung
Trusted Enthusiast

Re: Ignore Multiple Button Clicks

Message contains an attachment

Hi, This VI was created some time back (in LV7.1) in answering to a question raised in the Chinese Language forum. And, I thought it may be useful to prevent a double click by setting a minimum time a button must be clicked and hold to constitute a valid click. (Though the question of how fast a double-click may varies)

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com