Centering digits in a number box

Jul 6, 2008 at 11:41pm

Centering digits in a number box

I have a GUI with a nice place to display some numbers. A numberbox, with the transparency set to full is placed appropriately to display the numbers. But I can’t seem to figure out how to center the numbers. Of course, for any given number it’s easy to center, but when the number of digits changes, the center shifts… here’s a simple patch that shows the problem — as you increase the number from 1 digit to 2 digits to 3 digits, the display appears to move to the right. So my question is if there a clever way to center the display no matter how many digits there are?

Any help much appreciated…

Bill Sethares

Here’s a patch:

– Pasted Max Patch, click to expand. –
#38766
Jul 7, 2008 at 12:22am

you can use tab:

– Pasted Max Patch, click to expand. –
#135466
Jul 7, 2008 at 1:03am

Thanks Ben, that’s perfect!

#135467

You must be logged in to reply to this topic.