I'm trying to left align the text in a label and have tried 2 ways of doing it without any success. The labels are in the top right hand corner and when they're all populated the text looks a mess as it's aligned to the right by default.
The first try being a loop I came across. I didn't like the idea of using a loop but tried it anyway.
The 2nd way is by ENUM_ALIGN_MODE. I added the input, the variable and the ALIGN_CENTRE and when I try to change the text alignment in the indicator options box, the ALIGN_LEFT, ALIGN_CENTRE and ALIGN_RIGHT have changed to Align to left border, Align to left border (yes it's in there twice) and Align to right border. I've tried coding it in the ObjectSet and ObjectGetInteger and couldn't get it working.
I'm obviously doing something wrong, any ideas please?
input ENUM_ALIGN_MODE TextAlignment = ALIGN_CENTER;
// The Loop I Tried
sPossTradingDay=" " + sPossTradingDay;
According to the documentation, the "OBJPROP_ALIGN" property is only valid for the "OBJ_EDIT", not "OBJ_LABEL": https://docs.mql4.com/constant_indices
So, when in doubt, try to read the documentation first!
PS! You can however, use a centred anchor point ( "ANCHOR_CENTER", "ANCHOR_LOWER" or "ANCHOR_UPPER"), to simulate centred text: https://docs.mql4.com/constants/objectconstants/enum_object/obj_label
Hi FMIC, thanks for replying.
I wondered where this post disappeared to lol, I posted it & it vanished. I realised that it was the labels that were not aligned because the labels are whatever size they need to be to fit the text. I was trying to align the left hand side of the labels when they were placed on the right hand side of the chart. All done now
To add comments, please log in or register