02-15-2024 09:25 AM
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
Solved! Go to Solution.
02-15-2024 09:36 AM
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.
02-15-2024 09:50 AM
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
02-15-2024 09:56 AM
@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.
02-15-2024 10:00 AM
@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.
02-15-2024 10:05 AM - edited 02-15-2024 10:13 AM
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.
02-15-2024 10:50 AM
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.
02-15-2024 10:56 AM
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.
02-15-2024 11:57 AM - edited 02-15-2024 12:00 PM
@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)