11-17-2017 03:45 AM
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.
11-17-2017 04:44 AM
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…
11-17-2017 06:33 AM
@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.
11-17-2017 09:37 AM
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?