ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button staying down after on mouse up event

I am catching on mouse up events for a button and the button is sometimes staying down after being pressed.

 

I have the button itself inside the event handler- I thought putting it there sovled this problem.

 

Is there something else I am missing?

 

The button is set to latch when released.

 

Thanks!

 

0 Kudos
Message 1 of 7
(3,551 Views)
Can you better define "sometimes"? Does it work more reliably if you use the "Value Change" event? What version of LabVIEW are you using? Can you strip out other stuff to see if the "other stuff" is interfering?
0 Kudos
Message 2 of 7
(3,547 Views)

I haven't tried value change yet.  Using LabVIEW version 7.1.  I haven't quite stripped everything out of the VI but if there's nothing common that I'm missing that will be my next step.

 

As far as sometimes, I haven't found anything specific its related to.  It happens maybe 5% of the time tops.  The event still fires properly and when I click the button again, while it is in the down state, the event fires properly again.

 

Dave

0 Kudos
Message 3 of 7
(3,541 Views)
It is actually pretty easy to "trap" a button when using the Mouse Up event (at least in LV 8.2).  I was unable to do it using the Value Change event, so that is probably a much better bet.  In case you haven't noticed, the Mouse Up event will fire even if you click in the label or other inactive region of your button.
Message 4 of 7
(3,534 Views)

A boolean latch action completes its action only when node is executed (or data is read from the boolean) When a mouse up event or any other event triggers except for the value change, you are trying to trigger event on a front panel object but you are not actually reading the data. No matter the boolean button is spaced inside or outside the event.

 

To get the latch action properly, add a value change event and place the boolean control inside this event. Do nothing in this event if it is not required. Let me know if it works properly.   :smileyhappy:

Message 5 of 7
(3,514 Views)

Thanks Vsh.  The value change is working.

 

Why isn't the data read if the button is placed inside the loop?  

 

 

0 Kudos
Message 6 of 7
(3,503 Views)

Data is indeed read, but if you notice, you'll see the last selected data. If you have set to true, data in mouse up event case reads false (When the control is inside the mouse up event case)

 

 

When you trigger an event on a Boolean control configured with a latching mechanical action, the Boolean control does not reset to its default value until the block diagram reads the terminal on the Boolean control. You must read the terminal inside the event case for the mechanical action to work correctly. As a reminder, a note appears in the Edit Events dialog box when you configure a vale change event on a latched Boolean control. 

 

0 Kudos
Message 7 of 7
(3,466 Views)