When tabbing into an ultraNumericEditor or for that matter any Infragistics control we want all the text to be selected. When we click in a control we want the cursor to be placed where we click. We do not want the control to retain last SelectionStart and SelectionLength values. Basically we are trying to get the Infragistics controls to work like they do In Office 365 Outlook Options.
I have read these posts and a few others.
Different behavior of text selection when tabbing into an ultratexteditor
Numeric Editor Question
I can accomplish this in the ultraTextEditor by using the Enter event but does not work if I use the AfterEnterEditMode. I thought this would also solve my issues with ultraNumericEditor, ultraCurrencyEditor and ultraDateTimeEditor because they seem to be built using some variation of textbox/ultraTextEditor. However the event does not work the same. It always selects all the text.
I found a way to get the desired behaviour in ultraNumericEditor, ultraCurrencyEditor and ultraDateTimeEditor by setting SelectionStart and SelectionLength to basically select all characters during the Validating event. I could do this in the Leave event if that is better. It would have been much easier if I could simply keep the control from retaining this information but I could not find a way.
I have attached a test solution with the controls working as I would like them to. Could be luck that they are working correctly.
The questions I have:
0081.SelectAll.zip
Thank you for the response. Not sure what you mean when you say may not be working in the way expect. By default the control retains SelectionStart and SelectionLength. If the control is going to save this information off the only choice I had was to set SelectionStart and SelectionLength to specific values to ensure it retained the correct information to select all when they exited the control. I would rather not have to do this at all but due to the design of the control it is the only way I have been able to get the desired result. I really just wanted to clear SelectionStart and SelectionLength when they exited so it would act like it did the first time the user tabbed into the control. I could not find a way to do this. I am open to suggestion or a better way.
Hello Michael,
I have been investigating into the behavior you are seeing, and I have some information for you on this matter. I will answer the questions in the order they were asked.
1. I think these changes are solid, but they may not be working in the way you expect. The Validating event is firing when you leave the editor, and so when you tab back into the editor, this is likely because it is retaining the selection from the last time you exited. The mouse click is resetting the cursor position, as expected.
2. The UltraTextEditor is different than the other controls, since it is not a “masked” editor. When in edit mode, the UltraTextEditor uses a .NET TextBox, whereas the other “masked” editors are using a custom element.
3. I believe this is due to the same reason as point 2. This behavior can be implemented using the KeyDown event of other editors, though. I will be checking with our development teams to see if the masked editors are supposed to support Ctrl+A and Alt+Backspace, though.
Please let me know if you have any other questions or concerns on this matter.