Right aligning numeric output

 

Hello,

Not sure why this is so difficult, but I am trying to line up numeric output on a chart use an OBJ_LABEL object.

I want numbers to be vertically displayed and right aligned.  The printf() function doesn't seem to do this

correctly, I have also tried using TextGetSize() and adjusting each string x coordinate (containing a number with 2 decimal

places) within a fixed pixel buffer.   TextOut() may be the answer but I'm stumped trying to get that to work.

If anyone has solved this problem, I would greatly appreciate any assistance.

Thanks,

Phred

 

You can align them to the right, by using a right anchor.

I don't know if there is a font with all characters the same width in pixels, that way they would line up nicely, but maybe look odd? 

 
GumRai:

..... if there is a font with all characters the same width in pixels, that way they would line up nicely, but maybe look odd? 

  Courier New
 
rod178:
  Courier New
Thank you - useful to know :)
 
 
phredotaku:

Hello,

Not sure why this is so difficult, but I am trying to line up numeric output on a chart use an OBJ_LABEL object.

I want numbers to be vertically displayed and right aligned.  The printf() function doesn't seem to do this

correctly, I have also tried using TextGetSize() and adjusting each string x coordinate (containing a number with 2 decimal

places) within a fixed pixel buffer.   TextOut() may be the answer but I'm stumped trying to get that to work.

If anyone has solved this problem, I would greatly appreciate any assistance.

Thanks,

Phred

Thanks for the suggestions everyone.  I tried the first one from GumRai and it worked perfectly!!  Thanks for the help.


Phred

Reason: