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