CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2012
    Posts
    37

    Question How to FIX the annoying NumericUpDown behavior

    Hello!

    I am using NumericUpDown control as input for a range between 10 and 22000. So I set the minimum to "10", the maximum to "22000" and the thousand separator as true. Because of these settings, I am experiencing a very annoying behavior. Let's say you would like to type "100", which is within the range. By the time you type "1", the **** NumericUpDown won't wait for you to type "00", instead it shows "10" (minimum value) and moves the cursor to the LEFT, so you have to click again on the right side to type "0" again. Very annoying.

    Then let's say you're going to type "10050" and 100 is already there. You click and try to type "5"... It puts the thousand separator and again, moves the cursor to the LEFT, as result you now have "5,100". Extremely annoying.

    So annoying that it's actually surprising! I am using VC++ Express 2008. How could I possibly solve this problem without a bunch of code and timers to work around??

    Any input will be highly appreciated. Thank you!

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: How to FIX the annoying NumericUpDown behavior

    I can't reproduce either of the behaviors you describe myself here with a naked NumericUpDown configured to the parameters you name (at least not with .NET 4 on XP Pro SP3). I suspect there are some event handlers of your own involved that are of course changing part of the behavior. Looks like you're trying to update the control's Value as soon as the user has entered a digit. Sure, changing the value property makes the control update its display representation, thereby causing the mess-up you describe.

    So please post some demo (or real, if feasible to illustrate the problem that way) code reproducing the issue here. All the pertinent event handlers probably would be enough I think. Then we can see what we can do.

    Unless I'm mistaken, you most probably won't get away without performing some twists, maybe involving timers, maybe not. Modifying the behavior of the spin control is tricky; I already experimented with that myself...
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jun 2012
    Posts
    37

    Re: How to FIX the annoying NumericUpDown behavior

    Quote Originally Posted by Eri523 View Post
    I can't reproduce either of the behaviors you describe myself here with a naked NumericUpDown configured to the parameters you name (at least not with .NET 4 on XP Pro SP3). I suspect there are some event handlers of your own involved that are of course changing part of the behavior. Looks like you're trying to update the control's Value as soon as the user has entered a digit. Sure, changing the value property makes the control update its display representation, thereby causing the mess-up you describe.

    So please post some demo (or real, if feasible to illustrate the problem that way) code reproducing the issue here. All the pertinent event handlers probably would be enough I think. Then we can see what we can do.

    Unless I'm mistaken, you most probably won't get away without performing some twists, maybe involving timers, maybe not. Modifying the behavior of the spin control is tricky; I already experimented with that myself...
    Hi Eri! As always, you're willing to help, thank you!

    It was a very time sensitive situation so I got away with some "twists"... I really did set up a timer to perform the task. So I solved the problem by clearing the timer when the user clicks and when a value is changed. After a while, the timer overflows, pools the number and performs the task.

    I thought there would be a more "conventional" maneer to solve this, but apparently there isn't.

    Anyway, thanks a lot for your help.

    Cheers!

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: How to FIX the annoying NumericUpDown behavior

    Quote Originally Posted by fernando306 View Post
    Hi Eri! As always, you're willing to help, thank you!
    You're welcome, though this time it looks like I couln't really do much to actually help you.

    Apparently the spin control is the prevalent one of which developers think its default behavior is uncool; not just the two of us, but also quite some more. As far as I am concerned, after doing quite some complicated twiddling, in fact I reverted to the control's default behavior, since after all, that did appear to be the most natural one.

    Glad to hear you got your program to behave the way you desired, but after all it's your clients who should perceive your program's behavior as natural. The fundamental problem with developers twiddling around with the behavior of the spin control (or any other standard control for that matter) is that hardly ever any two developers will tweak the behavior exactly the same way, eventually leaving behind some inevitable degree of overall user irritation.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Jun 2012
    Posts
    37

    Re: How to FIX the annoying NumericUpDown behavior

    Hi Eri!

    I fully agree with you. There always will be some level of user irritation, I'm actually concerned about what they will think about the program's feel... But that's the best I could do at the moment.

    Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured