Get XSIZE of a LABEL OBJECT - Is it possible?

To add comments, please log in or register
Lime
650
Lime  

Hi Coders!

Is is possible to get the XSIZE of a LABEL OBJECT?

I tried this code:

label_object_xsize = ObjectGetInteger(0,object_name,OBJPROP_XSIZE);

But I got this error message: Unknown object property

Thank you in advance.

Relative

whroeder1
17927
whroeder1  
Relative: Is is possible to get the XSIZE of a LABEL OBJECT?
What is listed in the documentation?OBJPROP_XSIZEThe object's width along the X axis in pixels. Specified for OBJ_LABEL, OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects.
Try printing out your object_name, ObjectType(object_name), and ObjectGet(object_name, OBJPROP_XSIZE)
Lime
650
Lime  
WHRoeder:
What is listed in the documentation?OBJPROP_XSIZEThe object's width along the X axis in pixels. Specified for OBJ_LABEL, OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects.
Try printing out your object_name, ObjectType(object_name), and ObjectGet(object_name, OBJPROP_XSIZE)

I read the documentation.

I checked the ObjecType: 2014.03.07 18:09:10.504 FXC BasE v2.03 EURUSD,H1: ObjectType(object_name): 23 OBJ_LABEL: 23

Ex Ovo Omnia
3408
Ex Ovo Omnia  
From my experience, implementation of graphic objects is buggy and unfinished. Feel free to post it to the service desk, but I have no idea if they already treat them as bugs, or still code under development.
Lime
650
Lime  
Ovo:
From my experience, implementation of graphic objects is buggy and unfinished. Feel free to post it to the service desk, but I have no idea if they already treat them as bugs, or still code under development.
Ok.
eevviill7
20515
eevviill7  

I have problem too.

ObjectGet returns 0 

JD4
840
JD4  
Relative:

Hi Coders!

Is is possible to get the XSIZE of a LABEL OBJECT?

I tried this code:

But I got this error message: Unknown object property

Thank you in advance.

Relative

When using variable and constant names (and anything else actually) in programming MQL, case makes a difference.  Basically variablename, VariableName, and VARIABLENAME are all different items.  If you used label_object_xsize, and it was looking for LABEL_OBJECT_XSIZE, it would give your program problems.  You also have to make sure that you use the same capitalization every time a name like that appears within the program.
eevviill7
20515
eevviill7  
eevviill:

I have problem too.

ObjectGet returns 0 

0 than 69(ok) 69 69 0 0 0 69 0

Moderators can you fix the problem? 

eevviill7
20515
eevviill7  
eevviill:

0 than 69(ok) 69 69 0 0 0 69 0

Moderators can you fix the problem? 

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {

obj_create_f("textb16",DoubleToString(Bid,Digits));
int x_plus=int(ObjectGetInteger(0,"textb16",OBJPROP_XSIZE));
Alert(x_plus);

   return(rates_total);
  }
//+------------------------------------------------------------------+

////////////////////////////////////////////////////////////////////////
void obj_create_f(string name,string object)
{

if(ObjectFind(name)==-1)
{
ObjectCreate(0,name,OBJ_LABEL,0,0,0);
ObjectSetInteger(0,name,OBJPROP_CORNER,1);
ObjectSetInteger(0,name, OBJPROP_XDISTANCE,20);
ObjectSetInteger(0,name, OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0,name, OBJPROP_FONTSIZE, 23);
ObjectSetInteger(0,name,OBJPROP_ANCHOR,ANCHOR_RIGHT_UPPER);
ObjectSetInteger(0,name, OBJPROP_COLOR, clrRed);
}
ObjectSetString(0,name,OBJPROP_TEXT,object);

}
Slava
Moderator
7567
Slava  

You can get requested data after chart drawing only.

Size of label object calculated at chart drawing. You cannot get size immediately after label object create

eevviill7
20515
eevviill7  
stringo:

You can get requested data after chart drawing only.

Size of label object calculated at chart drawing. You cannot get size immediately after label object create

You look at my picture or not???

Alerts return 0 137 0 0 137 137 0 0 ... AFTER that when object was created(and appairs on chart).

Please, fix your function

12
To add comments, please log in or register