title: MQL4 Drawing a Dynamic Rectangle_Label with a Text in It
body: <p>I am trying to draw a Rectangle Label with a text in it every tick.. I want a text to fit exactly in to a Rectangle_Label.. As a text i am using Label..  But cant get it to work exactly.. It is not correctly situated.. </p>
  
  <p>In Fact i would like to create a class that would do it all in one... Just like a rectangle with text in it that would be always having same co ordinance and size etc.. </p>
  
  <p>Any help would be greatly appreciated...</p>
  
  <pre><code> bool createRectangleLabel(long chart_ID,string name,string labelName,int shift,double price,string text,double xSize,double ySize,double xOffSet,double yOffSet,double xDistance,double yDistance)
       {
        if(ObjectCreate(chart_ID,labelName,OBJ_RECTANGLE_LABEL,0,TimeCurrent()-shift,price))
      {
       Print(xDistance+"  "+yDistance);
       ObjectSetInteger(chart_ID,labelName,OBJPROP_BGCOLOR,clrBlack);
       ObjectSetInteger(chart_ID,labelName,OBJPROP_XDISTANCE,xDistance);
       ObjectSetInteger(chart_ID,labelName,OBJPROP_YDISTANCE,yDistance);
       ObjectSetInteger(chart_ID,labelName,OBJPROP_YSIZE,ySize);
       ObjectSetInteger(chart_ID,labelName,OBJPROP_XSIZE,xSize);
       ObjectSetString(chart_ID,labelName,OBJPROP_TEXT,text);
       ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,ANCHOR_CENTER);
  
       return true;
      }
    else
      {
       Print("createRectangleLabel return error code: ",GetLastError());
       Print("+--------------------------------------------------------------+");
       return false;
      }
   }
     bool createLineText(long chart_ID,string name,string labelName,int shift,double price,string text)
   {
    int xDistance=0;
    int yDistance=0;
    int xSize,xOffSet;
    int ySize,yOffSet;
    bool i=ChartTimePriceToXY(chart_ID,0,TimeCurrent(),price,xDistance,yDistance);
  
    if(ObjectCreate(chart_ID,name,OBJ_LABEL,0,TimeCurrent()-shift,price))
      {
       ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,clrWhite);
       ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,xDistance);
       ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,yDistance);
       ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
       ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,ANCHOR_CENTER);
       ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clrWhite);
       ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,10);
       xSize = ObjectGet(name,OBJPROP_XSIZE);
       ySize = ObjectGet(name,OBJPROP_YSIZE);
       xOffSet = ObjectGet(name,OBJPROP_XOFFSET);
       yOffSet = ObjectGet(name,OBJPROP_YOFFSET);
       TextGetSize(name,xSize,ySize);
       createRectangleLabel(chart_ID,name,labelName,shift,price,text,xSize,ySize,xOffSet,yOffSet,xDistance,yDistance);
       return true;
      }
    else
      {
       Print("createLineText return error code: ",GetLastError());
       Print("+--------------------------------------------------------------+");
       return false;
      }
   }
  </code></pre>