even number conundrum

Dan Nigrin's icon

I need to constrain a UI object to only allow for selection of even numbers between 2 and 254. Not a hard thing (see patch)...

Max Patch
Copy patch and select New From Clipboard in Max.

...but I have additional constraints that need to be considered:

  • the "scrollability" of the number box in the patch above is not great. If you click and drag quickly it works, but if you slow down, it can become "unresponsive." I've tried other methods of constraining to even numbers too (using modulo operators, if statements, etc...) and all seem to have the same challenge. I've also tried deferlow'ing the set message, with no real change.

  • the number box (and any associated objects) will need to be script created, as I do not know in advance how many I will need. And I may needs lots of them.

  • the value needs to be selectable with mouse/scrolling, or with typing of value directly from the keyboard (this removes the ability to use a umenu in scroll mode, or live.menu).

  • the object needs to respond to "set" messages to update the value programmatically. Those values will only be even numbers within the correct range however.

Do I just have to live with the crappy scrollability as in the patch above?

Thanks in advance for ideas!

Source Audio's icon

is it bad if number gets rounded at mouse release ?

Dan Nigrin's icon

OMG - I never knew that mousefilter setting existing for number boxes!! Thank you, that's perfect!