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
1140
Numeric Editor Question...
posted

I have an io field where I want to accept a number from 0 - 99,999.   So I use the Ultra Numeric Editor and set the Min Value to 0, the Max Value to 99999.  What's irritating me is when the field is displayed on the screen it has a Zero in it (which is correct) and when I tab into the field, the cursor is set in front of the 0. Consequently, if I enter a 1, the number becomes 10...  I don't want that, I want it to change the value from 0 to 1.  What can I set to have the Value automatically selected when I enter the field so that whatever I type OVERWRITES the value that was in there?  

Why does the UltraMaskedEdit select the value when you tab into the field but the UltraNumericEditor doesn't?  I would use the UltraMaskedEdit control as my Numeric IO field if I could set it to right justify the value and enter the value from the right side like a Numeric editor would, but unfortunately, I can't seem to make it do that...  More irritation...

My second complaint on the Numeric Editor is that if I delete the 0 then try to exit the field, I get a beep and the cursor won't leave the field until I put in a 0 or some other value.  (I realize I DO have the Nullable property set to False, which is what I want)   How can I set a Default (like 0) value for the field?    

Finally, I STILL don't get emailed replies to my posts, even tho I ask it to.

 

Parents
  • 469350
    Suggested Answer
    Offline posted

     

    Hi Steve,

    Wolven said:

    I have an io field where I want to accept a number from 0 - 99,999.   So I use the Ultra Numeric Editor and set the Min Value to 0, the Max Value to 99999.  What's irritating me is when the field is displayed on the screen it has a Zero in it (which is correct) and when I tab into the field, the cursor is set in front of the 0. Consequently, if I enter a 1, the number becomes 10...  I don't want that, I want it to change the value from 0 to 1.  What can I set to have the Value automatically selected when I enter the field so that whatever I type OVERWRITES the value that was in there?  

    Why does the UltraMaskedEdit select the value when you tab into the field but the UltraNumericEditor doesn't?

     

    I did a brief test using the inbox TextBox control, the UltraNumericEditor, and the UltraMaskedEdit control.

    When you tab into the TextBox or the UltraMaskedEditor, it appears to select whatever text was last selected when you left the control. So initially, the first time you tab into one of these controls, it selects the entire text so you can overwrite it. But once you enter one of these controls and change the selection or move the cursor, then the next time you tab into that control, the cursor and selection return to their last known state.

    For example, if you tab into a TextBox the first time, all of the text is selected. If you then type something into the TextBox and then move away and tab back into it, the text is not selected the second time. Instead, the cursor appears in the last place you left it.

    The UltraNumericEditor seems to follow the same behavior, except that it does not select all of the text the first time you tab into it. So this does indeed appear to be a bug in the control. I'm going to forward this thread to Infragistics Developer Support so they can write this up and get it corrected.

    Wolven said:
    I would use the UltraMaskedEdit control as my Numeric IO field if I could set it to right justify the value and enter the value from the right side like a Numeric editor would, but unfortunately, I can't seem to make it do that...  More irritation...

    Have you tried something like this?

    this.ultraMaskedEdit1.Appearance.TextHAlign = Infragistics.Win.HAlign.Right;

    Wolven said:
    My second complaint on the Numeric Editor is that if I delete the 0 then try to exit the field, I get a beep and the cursor won't leave the field until I put in a 0 or some other value.  (I realize I DO have the Nullable property set to False, which is what I want)   How can I set a Default (like 0) value for the field?    

    Wolven said:
    My second complaint on the Numeric Editor is that if I delete the 0 then try to exit the field, I get a beep and the cursor won't leave the field until I put in a 0 or some other value.  (I realize I DO have the Nullable property set to False, which is what I want)   How can I set a Default (like 0) value for the field?    

    You could do something like this:


            private void ultraNumericEditor1_ValidationError(object sender, Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs e)
            {
                UltraNumericEditor numericEditor = (UltraNumericEditor)sender;
                string invalidText = e.InvalidText.Replace("_", "").Trim();
                if (invalidText == null || invalidText.Length == 0)
                {
                    e.RetainFocus = false;
                    numericEditor.Value = 0;
                }
            }

    Wolven said:
    Finally, I STILL don't get emailed replies to my posts, even tho I ask it to.

    I have not heard any other customer complaints about this. I, myself, receive dozens of e-mail notifications from the forums every day. It seems unlikely that there is some problem with the forums themselves that is affecting only you. This is most likely due to a spam filter on your end - if not on your machine, then perhaps on the part of your ISP.

Reply Children