Numeric stepper control


#1

Good Evening,

I’m looking to define simple stepper control that will add and remove number from input or box widget
have created one but unable to limit on count… e.g. numeric value should less than 1 and should not greater then 32. Or button that increase and decrease becomes disable once value mentioned above meets.
Can someone help to see attach file?

Thank you,
~Vijustepper.rp (59.8 KB)


#2

Take a look at this updated file:
stepper.rp (67.2 KB)

The “spinnerUp” widget tests if the value of “myCounter” is equal to “1 less than the limit” (e.g., “31”). If true, it increases myCounter by 1 and sets the dynamic panel “up” to “disable”. Else it simply increases myCounter. Likewise, for spinnerDown, if myCounter is equal to “1 more than the limit” (e.g., “2”).

If your number box was a Text Field widget, you could use its Text Changed event to test its own value and disable/enable buttons accordingly.

A few other improvements…

  • Any time the spinnerUp is clicked it enables spinnerDown and likewise for clicking spinnerDown.
  • The dynamic panels, “up” and “down” have blank OnDrag events. This prevents accidentally selecting the text on the spinnerUp and spinnerDown widgets, which tends to happen when rapidly clicking them, due to moving the mouse/finger/pointer slightly when pressing down, thus triggering a “drag” event in the browser–if there is no handler for dragging the browser assumes you want to select text and/or images on the page.

#3

Thanks mbc66…
About provided improvements, I thought of asking that too
but then I just don’t wanted to be demanding :slight_smile: and you read my mind

Simply love it