Centering digits in a number box

Sethares's icon

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:

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

Ben Bracken's icon

you can use tab:

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

Sethares's icon

Thanks Ben, that's perfect!