Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Spin buttons

I've implemented a spin button on an editline. That's straight forward.
I seem to be missing something though. As the spin button doesn't actually do anything by itself other than fire the OnSpinClick event, I fail to see how the SpinRange Property applies?
It would be handy if it worked but I don't see the relationship considering we still need to code the outcome of the onspinclick.

Comments

  • If you just set SpinButton to true, then the default behavior is to fire the OnSpinClick event. If you set the SpinRange property, then the OnSpinClick will not be fired and the spin buttons will automatically update the edit line.

    The documentation was sorely lacking on this nuance, so I've updated it to be more clear.
  • so you're saying that the SpinButton and SpinRange properties are mutually exclusive such that you either
    • set SpinButton to true and handle the OnSpinClick event or
    • set SpinButton to false (or leave it as the default setting) and set the SpinRange property
    Is that the idea?
  • Not exactly. The SpinButton property adds the spin buttons to the control, but if you set SpinButton only, then there is no automation. You must also set SpinRange if you want automation. Otherwise, you'll get the OnSpinClick event.
  • Ok. That's the way I initially interpreted it but when I set the SpinRange property, it had no effect.
    That prompted the question in the first place.

    The problem however was mine. When setting the SpinRange property I used the incorrect format for CtrlID in that I used the period delimiter instead of the semicolon delimiter.

    Get that right and it works as advertised and I can remove my superfluous event code.
    Thanks @KevinFournier
  • I see. Been there myself a time or too. I would have loved it if we could have used periods. At any rate, it prompted me to improve the documentation, so the discussion was valuable. Thanks.
Sign In or Register to comment.