Download MetaTrader 5
To add comments, please log in or register
Do you want to become a well-known developer? Execute the orders of traders in the Freelance service!
Lime
642
Lime 2014.03.07 16:11 

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
14200
whroeder1 2014.03.07 16:33  
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
642
Lime 2014.03.07 17:12  
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

Ovo Cz
3040
Ovo Cz 2014.03.07 21:05  
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
642
Lime 2014.03.07 22:33  
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.
Vasyl Nosal
18443
Vasyl Nosal 2015.07.27 20:59  

I have problem too.

ObjectGet returns 0 

JD4
1101
JD4 2015.07.28 05:29  
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.
Vasyl Nosal
18443
Vasyl Nosal 2015.07.28 06:15  
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? 

Vasyl Nosal
18443
Vasyl Nosal 2015.07.28 06:29  
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);

}
Slawa
Moderator
6790
Slawa 2015.07.28 08:33  

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

Vasyl Nosal
18443
Vasyl Nosal 2015.07.28 08:55  
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