LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to cancel value change event?

I have a numeric control. When I edit ist value but the mouse Cursor leaves the control, I want to cancel the value Change Event and Keep the old value.

Why will be the value Change Event fired, if I set the key Focus to false? The same happens when I set the visible property of the control to false.

0 Kudos
Message 1 of 4
(3,149 Views)

Hi Madottati,

 

Why will be the value Change Event fired, if I set the key Focus to false?

Removing KeyFocus is like pressing the Enter key or like clicking the mouse button outside the control: the control will be updated to its new value…

 

If you really want to make sure the user has input the correct value you could create your own input using several buttons (similar to a calculator) with an "OK" and a "CANCEL" button. Only upon pressing OK the new value is used…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(3,126 Views)

@Madottati wrote:

I have a numeric control. When I edit ist value but the mouse Cursor leaves the control, I want to cancel the value Change Event and Keep the old value.


Why would you do this?  It is quite common for me to click into the control and then move the mouse out of the way while I update the value.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 4
(3,108 Views)

Although I also don't know why you'd want to do what it seems like you've described, it should be possible by checking if the value changed event occurs between a mouse enter and mouse leave event.

 

You'll presumably need some sort of statefulness, which could probably be written using a boolean shift register. Set true on enter, false on leave, and update the control to Old Value during the value change event if false on SR.

 

Is that what you're wanting?


GCentral
0 Kudos
Message 4 of 4
(3,084 Views)