How Can I Read Text From OBJ_EDIT MT4

 
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
 

Hello,

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


This time, I edited it for you.

 
angevoyageur:

Hello,

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


This time, I edited it for you.


Thank You angevoyageur
 
ObjectGetString(0,"txtMaxTrades",OBJPROP_TEXT,
0 

Use 0 instead of 1 for chart shift