stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Help with Display function Empty4 to MT5
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=6346
Page 1 of 1
Author:  szfxtrader [ Tue Jul 11, 2023 7:05 pm ]
Post subject:  Help with Display function Empty4 to MT5

Hi, I am trying to use the display function on MT5, but I couldn't make it to work probably, main reason: ObjectSet, all help are welcome, thank you.

void Display(string text)
{

string labstr = "OAM-" + IntegerToString(displaycount);
string textpart[5];

int offset = 0;
uint w, h;

for (int cc = 0; cc < 5; cc++)
{

textpart[cc] = StringSubstr(text, cc * 63, 64);

if (StringLen(textpart[cc]) == 0) continue;

labstr = labstr + IntegerToString(cc);

if (ObjectFind(0, labstr) < 0)
{

ObjectCreate(0, labstr, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, labstr, OBJPROP_CORNER, 0);
ObjectSetInteger(0, labstr, OBJPROP_XDISTANCE, DisplayX + offset);
ObjectSetInteger(0, labstr, OBJPROP_YDISTANCE, DisplayY + displaycount * (int)(FontSize * 1.5));
ObjectSetInteger(0, labstr, OBJPROP_BACK, false);

}

//ObjectSet(labstr, textpart[cc], FontSize, FontName, Colour);

TextSetFont(FontName, (int)(-FontSize * 10), 0, 0);

TextGetSize(textpart[cc], w, h);

if (StringSubstr(textpart[cc], 63, 1) == " ") { offset+=(int)(w - FontSize * 0.3); }
else { offset += (int)(w - FontSize * 0.7); }

}

}
All times are UTC Page 1 of 1