Hi,
During the ValueChanged event of the UltraDateTimeEditor, I need to test whether the control is actually being changed by a user. For UltraTextEditors, I can test the Focused property.
The Focused property on the UltraDateTimeEditor works fine if the date is manually entered or the up/down arrows are used to change the date. However, if selecting a date from the dropdown, the focused property is always false.
If I used the AfterCloseUp event, is there a way to know if the date has changed from within the AfterCloseUp method.
Thanks.
Mike,
That's probably the way I'll go. Otherwise I'll be fighting this with any other control type that gets used.
Thanks!
JL
I wonder if you should be coming at this from the opposite angle. ContainsFocus may work better than Focused, but it's still not really reliable. The control could very well have focus when you are setting it's value in code.
It's very hard to tell if the user is updating the field. It's probably much easier to come at it from the other angle - you presumably always know when you are setting the value in code, so why not set a flag (or even disable the ValueChanged event) whenever you set the value in code?
Thanks for that. I'll give ContainsFocus a try and see how it goes. The design of the app is such that all fields are enabled by default and we check value-changed to see if the record has been updated.
You may always want to check ContainsFocus rather than Focused. ContainsFocus will be true if a child of the control has focus as well as the control itself.
If I read your question correctly, you're trying to determine if the user actually changed the value instead of something in your code. Why not just check the IsInEditMode property? I'm not sure if this is enough (i.e. what your code is doing and what you're trying to distinguish), but this might be a lot easier than trying to keep several flags and check other properties.
-Matt