I have a UltraNumericEditor of NumericType Integer.The Value is 0(control default).
When the control gains focus, I want the default value of 0 to be highlighted.(Similar to what happens when we tab into a textbox).
I tried SelectAll() . SelectionStart etc: , to no avail. I tried Enter, Focus events..
Or I need to blank out the default value of 0. I couldn't find a way to do this.
I am expecting the user to enter an integer other than zero. Making Nullable true is not an option.I have been specifically asked not to do this.
Any help would be appreciated.Thanks!
Hi Eliza,
The NumericEditor behaves the same way the TextBox control does by default. If you tab into the control, it selected all of the text. If you click on the control, it will place the caret at the point you clicked. Once you have entered the control and established a SelectionStart point, subsequently tabbing into the control will remember the last position of the caret and use that instead of selecting everything. All of this is just like a TextBox.
If you want to the control to always select the text, regardless of whether the user tabs into or clicks on it, then it's a little tricky. Calling SelectAll from AfterEnterEditMode would seem to be the obvious solution, but it doesn't work because the control enters edit mode on the MouseDown and then it positions the caret after that operation is complete. So the only way to to do this is to create some sort of delay and then select all of the text after the control's internal processing is complete.
One easy way to do that is by using a BeginInvoke:
private void ultraNumericEditor1_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.SelectAllTextInNumericEditor)); } private void SelectAllTextInNumericEditor() { this.ultraNumericEditor1.SelectAll(); }
Hi I have a UltraNumericEditor, is there a way to overwrite the existing value in it while typing.
Example:
I have a UltraNumericEditor with mask, {double:-3.1}.
when i type in the controls it should overwrite the existing text in it. I don't want to Select all text and overwrite all text.
This functionality is seen in .net control MaskedTextBox, when the InsertKeyMode is set to Overwrite.
Thank you
Hi Toji,
UltraNumericEditor and the masked editors do not have this functionality. You can Submit a Feature Request and perhaps this feature can be added in the future, but there's no way to do it right now.
Hi Mike,
The UltraCurrencyEditor has this functionality and the UltraNumericEditor does not. That's confusing for the end-user they expect the same behaviour.
Regards
Arnaud
Hi Arnaud,
I'm not following you. If one supports this and the other doesn't, then that would be very strange, because both editors derive from the same base class.
What functionality, exactly, are you talking about? I tried this out with an UltraCurrencyEditor and an UltraNumericEditor and they both behave exactly the same for me.
Having said that, they both DO seem to support an overwrite mode when you toggle the Insert key. At least in the latest version.