Background box sizing

 

Hi,

I am trying to create a background box.

I seem to have a problem with adjusting the size, It starts at the right position, but I can't seem to get the length longer nomatter what I enter in the size number it doesn't change.

No matter what I change the x_sizeb & y_sizeb to, nothing happens.


Any help would be gratefully appreciated.

void CreateBackground (string backName, string text, int Bfontsize, int LabelCorner, int xB, int yB, int x_sizeb, int y_sizeb)
{
xB=-470;
yB=20;
x_sizeb=510;
y_sizeb=200;  
      if(ObjectFind(backName) == -1){
      ObjectCreate(backName, OBJ_LABEL, 0, 0, 0, 0, 0);}
      ObjectSetText(backName, text, Bfontsize, "Webdings");      
      ObjectSet(backName, OBJPROP_CORNER, 1);
      ObjectSet(backName, OBJPROP_BACK, true);
      ObjectSet(backName,OBJPROP_XSIZE,x_sizeb);
      ObjectSet(backName,OBJPROP_YSIZE,y_sizeb);
      ObjectSet(backName, OBJPROP_XDISTANCE, xB+adj);
      ObjectSet(backName, OBJPROP_YDISTANCE, yB+adjy );    
      ObjectSet(backName, OBJPROP_COLOR, clrWhite);
}  
 

Are you using MT5?

Then you should change it as follows.

ObjectSetText --> ObjectSetString

ObjectSet --> ObjectSetInteger

 
Nagisa Unada:

Are you using MT5?

Then you should change it as follows.

ObjectSetText --> ObjectSetString

ObjectSet --> ObjectSetInteger

Hi Nagisa,

No,, I am using MT4

 
Kristina Suh:

Hi Nagisa,

No,, I am using MT4

In future please post in the correct section

I will move your topic to the MQL4 and Metatrader 4 section.

 

Check sample code from the documentation on OBJ_LABEL, or at least add error checking for the ObjectCreate() function call.

OBJ_LABEL - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL4 Reference
OBJ_LABEL - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
The following script creates and moves Edit object on the chart. Special functions have been developed to create and change graphical object's properties. You can use these functions "as is" in your own applications. //| Create a text label                                              |               chart_ID=0,               ...
Reason: