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
How to customize spin increment/decrement values based on cursor position in UltraNumericEditor

I have a control which accepts decimal value like 20.0000. I want to customize the spin increment values based on position of the cursor. I have 2 scenarios to take care.

1. When cursor position is right side of the decimal, increment/decrement value should be 0.01

2. When cursor position is left side of the decimal, increment/decrement value should be 1.0000

Anybody can help please?


  • 28750
    Offline posted

    Hello Raj,

    I have been investigating into the requirement that you are looking to achieve, and this will not currently work with the current implementation of the spin buttons in the UltraNumericEditor. Instead, I would recommend that to achieve this, you essentially create your own spin buttons by adding EditorButton instances to the ButtonsRight or ButtonsLeft collection of the UltraNumericEditor. This will allow you to increment the Value of the editor in the way that you want. You can check whether or not the cursor is on the right or left side of the decimal point by checking the SelectionStart property of the editor against the MaskInput of the editor.

    For example, if your MaskInput of the editor is “nn.nnnn” and your SelectionStart returns either 0 or 1, you are on the left side of the decimal point. With that mask, values of 2 – 5 would be the right side of the decimal point.

    Please let me know if you have any other questions or concerns on this matter.