Download MetaTrader 5

How Can I Read Text From OBJ_EDIT MT4

To add comments, please log in or register
qw12er
13
qw12er  
int OnInit()
{
//--- indicator buffers mapping
ObjectCreate("txtMaxTrades", OBJ_EDIT, ChartWindowFind(), 0, 0);
ObjectSetText("txtMaxTrades","" + "0",13, "System", White);
ObjectSet("txtMaxTrades", OBJPROP_CORNER, 0);
ObjectSet("txtMaxTrades", OBJPROP_XSIZE, 25);
ObjectSet("txtMaxTrades", OBJPROP_XDISTANCE, 55);
ObjectSet("txtMaxTrades", OBJPROP_YDISTANCE, 55);
//---

ObjectCreate("btnSave", OBJ_BUTTON, ChartWindowFind(), 0, 0);
ObjectSet("btnSave",OBJPROP_COLOR,clrBlack);
ObjectSet("btnSave",OBJPROP_BGCOLOR,clrWhite);
ObjectSet("btnSave",OBJPROP_BORDER_COLOR,clrWhite);
ObjectSetString(0,"btnSave",OBJPROP_TEXT,"SAVE");
ObjectSetString(0,"btnSave",OBJPROP_FONT,"Segoe UI Semibold");
ObjectSet("btnSave", OBJPROP_CORNER, 0);
ObjectSet("btnSave", OBJPROP_XSIZE, 50);
ObjectSet("btnSave", OBJPROP_YSIZE, 15);
ObjectSet("btnSave", OBJPROP_FONTSIZE, 9);
ObjectSet("btnSave", OBJPROP_XDISTANCE, 180);
ObjectSet("btnSave", OBJPROP_YDISTANCE, 72);


return(INIT_SUCCEEDED);
}

void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
//---
string clickedChartObject=sparam;

if(id==CHARTEVENT_OBJECT_CLICK)
{

if(clickedChartObject=="btnSave")
{
Comment( ObjectGetString(0,"txtMaxTrades",OBJPROP_TEXT,1 ) ) ;
}
}

}

i want to read Current Text when clict button

Thank For Help

Sorry For My English
Alain Verleyen
Moderator
31185
Alain Verleyen  

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

qw12er
13
qw12er  
angevoyageur:

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


Thank You angevoyageur
To add comments, please log in or register