how to define lable that can move when resize the window

 

hi

I put label in my expert and use below codes


 bool Label(const long                    chart_ID=0,               
                 const string            name="Label",             
                 const int               sub_window=0,             
                 const int               x=0,                      
                 const int               y=0,                      
                 const ENUM_BASE_CORNER  corner=CORNER_LEFT_UPPER, 
                 const string            text="Label",             
                 const string            font="Arial",            
                 const int               font_size=9,            
                 const color             clr=clrRed,              
                 const double            angle=0.0,               
                 const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER,
                 const bool              back=false,               
                 const bool              selection=false,         
                 const bool              hidden=false,              
                const long               z_order=0)  
   ResetLastError();
   ObjectDelete(chart_ID,name);
   if(ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0))
     {
       ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
      ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
      ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
      ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
      ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
      ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
      ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
      ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
      ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
      ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
     // ChartRedraw();
      return(true);
       }
     else {
      Print(__FUNCTION__,
             ": failed to create => ",name," object! Error code = ",GetLastError());
      return(false);
     }
  }


Label(0,"SL",0,805,143);
                 ObjectSetText("SL","SL: "+SL, FontSize, FontName, FontColor);



here in this line:

Label(0,"SL",0,805,143);
                 ObjectSetText("SL","SL: "+SL, FontSize, FontName, FontColor);

I define 805 for

OBJPROP_XDISTANCE

and 143 for

OBJPROP_YDISTANCE


it worked correctly but problem is that when I resize the chart's window label  hide behind the window I mean I want when I resize window label move in correct place

below image is  showing label before I resizing the window



and below image is showing label after I resizing chart's window



in above image when I resizing window label behind the window


Best Regards

Neda

 
try CORNER_RIGHT_UPPER , and ANCHOR_RIGHT_UPPER
 
                      
                 const ENUM_BASE_CORNER  corner=CORNER_LEFT_UPPER,                
                 const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER,

Try using CORNER_RIGHT_UPPER  and ANCHOR_RIGHT_UPPER and redefine your distances.

 
Lorentzos Roussos:
try CORNER_RIGHT_UPPER , and ANCHOR_RIGHT_UPPER
thanks
Reason: