Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1871
Select text based on user interaction.
posted

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:

  1. Are these changes solid or am I just getting lucky with the end result?
  2. Why does ultraTextEditor work just like I would expect while the other controls do not? Is this a bug with the other controls? Is it a bug in ultraTextEditor?
  3. The only control that seems to respect CTRL + A or Alt + Backspace is ultraTextEditor. The other controls do not. I find that strange because numericUpDown supports both. I would think that ultraNumericEditor would be built at least similar to that control. I can easily accomplish this so I do not need help but I was surprised at how different every control seems to work in terms of standard key strokes.

0081.SelectAll.zip

Parents
  • 34810
    Offline posted

    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.

Reply Children