Download MetaTrader 5
To add comments, please log in or register
Write articles, help other developers and make money
phredotaku
22
phredotaku 2014.10.29 07:07 

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

Keith Watford
Moderator
7976
Keith Watford 2014.10.29 07:57  

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? 

rod178
276
rod178 2014.10.29 16:02  
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
Keith Watford
Moderator
7976
Keith Watford 2014.10.29 18:18  
rod178:
  Courier New
Thank you - useful to know :)
honest_knave
969
honest_knave 2014.10.29 18:33  
phredotaku
22
phredotaku 2014.10.30 02:58  
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

/
To add comments, please log in or register