Hallo,
I have a UltraTextEditor. I hooked the BeforeExitEditMode event, there I do some validation if "e.ApplyChanges" is true. The problem ist, that "ApplyChanges" is always true even if I exit with ESC.
I use Infragistics 7.3
Can anyone help me?
It's odd that I did the same thing yet I never get the BeforeExitEditMode event; are you certain you're not doing anything programmatically? One thought would be to override the OnClosing method of the form and to programmatically exit edit mode, i.e.:
protected override void OnClosing(CancelEventArgs e){ base.OnClosing(e); if (e.Cancel == false && this.ultraTextEditor1.Editor.IsInEditMode) this.ultraTextEditor1.Editor.ExitEditMode(true, false); }
-Matt
Yes, that's right. The CancelButtons causes the exit of the edit mode.
I have tested a little bit with the "IsForceExit"-Flag. This flag is never true, even if I exit the application.
My problem, how I can cancel the edit is still open.
Is there a button that is the CancelButton of your modal dialog? I haven't been able to get the (Before|After)ExitEditMode events to fire when pressing Esc on a modal dialog this way, so it's harder for me to track down what you can do about this. My guess is that the editor is getting a notification that it *has* to exit edit mode in this case, so it's going to try to commit the changes; does the IsForcingExit flag help you in this case?
Oh, yes you are right. That's my false.
The "BeforeExitEditMode" events fires because the modal form closes. And than it exit edit mode.
Now I have to reformulate my problem: Is there a possibility to set the "ApplyChanges" flag?
I had like to have the following behavior: If the user did a wrong entry and don't wants to correct his entry, I want cancel the edit operation and set the original value. Has the ultratextbox something like that build in or have I to do this on my datasource?
How are you exiting edit mode? In my test with a new UltraTextEditor, pressing the ESC key did not cause the editor to exit edit mode.