label in separate window New comment Wolfgang 2008.10.03 22:46 Dear coders! My problem: I want to display a label within a separate window. My code below does not work. Where is the mistake? Thanks for any help!! walb //--------------------------------------------------------- drawLabel("trend",text,22,color_text,10,10,"CourierBold"); //--------------------------------------------------- void drawLabel(string id, string text,int fsize, color fcolor,int x,int y,string font="CourierBold",int window = 0) { if(ObjectFind(id)==-1) { ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0); ObjectCreate(id, OBJ_LABEL, window, 0, 0); ObjectSetText(id,text, fsize, font, fcolor); ObjectSet(id, OBJPROP_CORNER, 1); ObjectSet(id, OBJPROP_XDISTANCE, x); ObjectSet(id, OBJPROP_YDISTANCE, y); } else { ObjectDelete(id); ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0); ObjectCreate(id, OBJ_LABEL, window, 0, 0); ObjectSetText(id,text, fsize, font, fcolor); ObjectSet(id, OBJPROP_CORNER, 1); ObjectSet(id, OBJPROP_XDISTANCE, x); ObjectSet(id, OBJPROP_YDISTANCE, y); } } //------------------------------- Collection of useful MT4 functions for coding Candel Sticks Indicator and Filters Coding help New comment
Dear coders!
My problem: I want to display a label within a separate window. My code below does not work. Where is the mistake?
Thanks for any help!!
walb
//---------------------------------------------------------
drawLabel("trend",text,22,color_text,10,10,"CourierBold");
//---------------------------------------------------
void drawLabel(string id, string text,int fsize, color fcolor,int x,int y,string font="CourierBold",int window = 0)
{
if(ObjectFind(id)==-1)
{
ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0);
ObjectCreate(id, OBJ_LABEL, window, 0, 0);
ObjectSetText(id,text, fsize, font, fcolor);
ObjectSet(id, OBJPROP_CORNER, 1);
ObjectSet(id, OBJPROP_XDISTANCE, x);
ObjectSet(id, OBJPROP_YDISTANCE, y);
}
else
{
ObjectDelete(id);
ObjectCreate("trend", OBJ_LABEL, WindowFind("trend"), 0, 0);
ObjectCreate(id, OBJ_LABEL, window, 0, 0);
ObjectSetText(id,text, fsize, font, fcolor);
ObjectSet(id, OBJPROP_CORNER, 1);
ObjectSet(id, OBJPROP_XDISTANCE, x);
ObjectSet(id, OBJPROP_YDISTANCE, y);
}
}
//-------------------------------