LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV2018 : File Dialog Express VI - Double clicking on a file name which is positioned over a control generates an event for the control

Solved!
Go to solution

Hi everyone,

 

I am using the File Dialog Express VI which opens the Windows File Dialog.

 

If I double click on a file which has a control on my front panel behind it an event for the control is generated.

 

The attached example generates a Mouse Up event for the Vehicle Button.  The Mouse Up event calls the File Dialog Express VI.  If you position the Windows File Dialog so the Vehicle Button is behind the file you double click on the Vehicle Button event gets triggered again.

 

Any help would be appreciated

0 Kudos
Message 1 of 9
(652 Views)
Solution
Accepted by topic author asnuaaron

This happens because the file selection ends on the second down-click of the mouse.  The file selection disappears and the mouse-up goes up on the vehicle button.  Try it yourself. Double-click a file but don't release mouse after the second click. 

 

To fix this, do not use Mouse Up event for Vehicle Button.  Use a Value Change event instead.  Set the mechanical action of the button to Latch When Released and put the terminal for the button within the Value Change event.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 9
(647 Views)

Thanks for your very rapid reply aputman.

 

I was hoping I could filter the 2nd mouse up by clearing the event queue but couldn't get that to work.

 

I'll give your 'Value Change' suggestion a try.  I have some controls where this might not be possible due to their interaction with the end user.

 

Thanks again

0 Kudos
Message 3 of 9
(633 Views)

@aputman wrote:

This happens because the file selection ends on the second down-click of the mouse.  The file selection disappears and the mouse-up goes up on the vehicle button.  Try it yourself. Double-click a file but don't release mouse after the second click. 

 

To fix this, do not use Mouse Up event for Vehicle Button.  Use a Value Change event instead.  Set the mechanical action of the button to Latch When Released and put the terminal for the button within the Value Change event.


I totally agree with that.

 

It is not clear why the button is switch action AND disabled, especially since we don't know the whole story. In your case you have disabled the control, so you obviously need to enable it for a value change event to trigger. Can you explain why it is disabled?

 

Triggering actions on disabled controls via e.g. "mouse-up" is generally very bad, Mouse actions ignore the enabled state and even work on indicators to trigger events.

0 Kudos
Message 4 of 9
(626 Views)

@asnuaaron wrote:

I have some controls where this might not be possible due to their interaction with the end user.


Can you explain that sentence? Controls are designed for user interactions, of course.

 

  • The user interacts with the program via controls
  • The program interacts with the user via indicators.
0 Kudos
Message 5 of 9
(617 Views)

Thanks for your comments altenbach

 

I changed the event from 'Mouse Up' to 'Mouse Down' and that seems to have fixed the problem.

 

My example vi was knocked up quickly just to demonstrate the problem.  The real UI is a lot more complex.

 

To try and explain a little more, my application is used on touchscreens as well as laptops with keyboards and as often happens during development and product life cycle the end user wants things changing so the button controls give me some flexibility with very little change to the UI or code.

 

My buttons are dual purpose, they trigger events when a user clicks on them and I also use them as indicators (green when OFF for OK, red when ON for Not OK).  This is why the buttons are disabled.  I find buttons are easy to add icons / images to.

0 Kudos
Message 6 of 9
(612 Views)

Value Change events are more intentional than a Mouse Down.  I think you'll find when using Mouse Down events, especially with touch devices, you'll get a lot of accidental button presses.    When it comes to UI design, IMHO there are very few justified reasons to use Mouse Up and Mouse Down on a button.  Look at any Windows application (Office, LabVIEW, GIMP, Discord, you name it) ...try to activate a button on Mouse Up/Down.  If you want a UI that follows conventional design standards, I would recommend against it.  Your explanation isn't clear enough, in my mind, to justify using Mouse Down. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 9
(596 Views)

I could use 'Value Change' events on most of my buttons but I have to use 'Mouse Up' or 'Mouse Down' on Numeric Controls as these pop up a data entry dialog.  The end user does not enter values directly into the controls so there will not be any 'Value Change' events.

0 Kudos
Message 8 of 9
(592 Views)

@asnuaaron wrote:

My buttons are dual purpose, they trigger events when a user clicks on them and I also use them as indicators (green when OFF for OK, red when ON for Not OK).  This is why the buttons are disabled.  I find buttons are easy to add icons / images to.


In that case, they should probably be indicators, not controls!

 

(Mouse events work fine on indicators and you can wire the state directly, no need for locals or value properties)

0 Kudos
Message 9 of 9
(557 Views)