LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean button that requires a double click

Solved!
Go to solution

Is it possible to make a boolean true/false button to require two mouse clicks to switch. We wish this feature to avoid accidentally clicking a button that opens or closes a valve?

 

Thank you, Bill

0 Kudos
Message 1 of 20
(5,264 Views)

It can be done if you capture the "mouse down?" filter event on the boolean, and track the time between two successive events.  On the first one, discard the event, and store the time.  On the second one, if the time is within some "double-click" time, don't discard the event, which will allow the boolean to switch.

 

Can I suggest as a simpler alternative that you use a pull-down (I'm thinking an enumeration or a picture ring)?  That also requires more than a passing mouse click to change the value, and is both easier to code and more intuitive.

Message 2 of 20
(5,263 Views)

Hi Bill -

 

I have to program similar functionality into my apps so that when buttons are pressed they are pressed "with intent" and not accidental.  Instead of a double-click, might I suggest an "unlock" key?  I have my users press and hold the CTRL key if they want to click something in the interface that does something that you don't want to do accidently (like open a valve).  You can use an event to detect when a key is pressed down and check to see if it is the CTRL key (or whatever key you like), and then Enable the controls.  Similarly when the key comes back up the controls are disabled again.

 

 

Message 3 of 20
(5,261 Views)

Nickerbocker - just curious, when you do this, do you visually show that the controls are enabled and disabled?  Otherwise it would seem a lot easier to me to check whether any modifier keys are pressed at the time of the mouse down event (or, with a filter event, discard if the modifier key isn't pressed).

0 Kudos
Message 4 of 20
(5,256 Views)

add a dialog to it....VALVE.png

Message 5 of 20
(5,253 Views)

Thank you. I will give this solution a try using space bar + mouse click.

0 Kudos
Message 6 of 20
(5,245 Views)

Hi,

 

Attached is sort of "timed button" that was created for another member some years ago (can't remember when was it though)...

 

It might be just another possible solution to your problem. So, I am adding it to the list 😉

Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 7 of 20
(5,231 Views)
Solution
Accepted by schieb2

@Ian: While i find the general idea very interesting, i don't like that timing is encapsulated only in the subVI. While it doesn't hog the CPU (which is good), it might give wrong impressions to new developers (no obvious wait funktion in the loop).

 

@OP: If it was only a double click you want to check, you might do something like in the attachment.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 8 of 20
(5,203 Views)
Dear Norbert

Thanks for the feedback. Fyi, it wasn't my idea but it was created based on the requirement of the member who needed such function.
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 9 of 20
(5,187 Views)

Norbert, neat trick! I had never thought of a use for a disabled control that is not also greyed out. I never tried it but I am surprised that a disabled control still generates mouse events.

=====================
LabVIEW 2012


0 Kudos
Message 10 of 20
(5,173 Views)