label in separate window

To add comments, please log in or register
Wolfgang
83
Wolfgang  

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);   

      }  

      }


//-------------------------------

To add comments, please log in or register