CChartObjectLabel Description problem

 

Hello,

there is a problem with  CChartObjectLabel::Description function.

Please look at the sample below. It should print 0 to console as Description is empty. 

 

 CChartObjectLabel     x_label;
 x_label.Create(0,"name",0,100,100);
 x_label.Description("");
                
 string x=x_label.Description();
 Print("StringLen=",IntegerToString(StringLen(x)));

Unfortunately, it returns 1. What is the reason ?

thank you 

 
//+------------------------------------------------------------------+
//| Set comment of object. |
//+------------------------------------------------------------------+
bool CChartObject::Description(const string new_text) const
{
//--- checking
if(m_chart_id==-1) return(false);
//--- tuning
if(new_text=="") return(ObjectSetString(m_chart_id,m_name,OBJPROP_TEXT," ")); <<--- if text="" then set text=" "
//--- result
return(ObjectSetString(m_chart_id,m_name,OBJPROP_TEXT,new_text));
}

 
avoitenko:

Hello avoitenko,

thank you. This explains it. Don't know how to access source code.

By the way: const string new_text makes no sense as new_text is a local copy.

const string& new_text would be better 

 
Don't know how to access source code.

Right click and select Go To Definition.


 

oh well, thank you.


Reason: