LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Two button dialog and mouse down filter event bug

Solved!
Go to solution

Ok, here's a weird one.  I've attached a VI that demonstrates the issue on my PC - LV 2018.

I'm trying to create a button with a confirmation dialog.  You press the button, you get an "Are you sure" dialog, and if you press "OK" the button is pressed, and if you press "Cancel" the button press is discarded.

 

In the VI I attached, I use an event triggered by the mouse down, and then filter the event based on the input to the dialog.  The cancel works great, but when I confirm the enable, it gets a bit funky.

 

The two button dialog doesn't return context to the original VI window, and the buttons won't switch.  Then, oddly enough, if you don't click on the back window, mousing over the "enabled" button causes it to transition between the colors for false and false to true transition with no button clicks.  If you then click on the original VI window, context is returned and sometimes the button does actually switch on.  Sometimes it doesn't.

 

To add insult to injury, if you run the whole thing with context highlighting, it works as intended, with no bug!  I've tried this with different types of buttons with similar results - I put three on the front panel.

 

Thoughts?  Does it do this for you as well? Am I missing something obvious?

 

Thanks!

0 Kudos
Message 1 of 3
(1,985 Views)
Solution
Accepted by topic author plus1etal

Just change the mechanical action of the buttons to Switch When Pressed.
This is no bug, it's the normal behavior of the Switch When Released mechanical action. You can try without running the VI, to click the button and keeping the mouse button pressed, move the mouse over the button. You will see those transitions between the colors that you talked about. The value of the button will change when you release the click. The same happens if you use the mouse down filter event only that the mouse button is not pressed so LabVIEW is waiting for a mouse up event to change the value of the button. You can simply click and release and button value will change but if you do it over the button you will cause the dialog to appear again.

Lucian
CLA
Message 2 of 3
(1,953 Views)

And there it is, as obvious as that.

 

Thanks!

0 Kudos
Message 3 of 3
(1,946 Views)