怎么获取获取按钮的单机时间? 新评论 Renjun Gu 2017.07.26 01:04 我用“ObjectCreate”创建了个按钮,按钮名称 “button1”,在“ OnChartEven”事件里获取单击按钮事件结果报错,有谁知道怎么改吗?报错内容:'button1' - undeclared identifier implicit conversion from 'string' to 'number' expression not boolean ')' - semicolon expected )' - unexpected end of program 代码如下:void OnChartEvent(const int id, // 事件标识符 const long& lparam, // 事件长整型参量 const double& dparam, // 事件双精度型参量 const string& sparam // 事件字符串型参量 ) { if(id==CHARTEVENT_OBJECT_CLICK) { Print("The mouse has been clicked on the object with name '"+sparam+"'"); if(button1=sparam) { Alert("你单击了按钮") } } } CHARTEVENT_OBJECT_CLICK New MetaTrader 4 Platform Build 971: Hotfix New MetaTrader 4 Build 970: Simplified demo account opening and expanded MQL4 features Jian Chen 2017.07.26 03:45 #1 108行要改成 if(StringCompare(sparam, "button1")==0)110行那个Alert函数调用语句后面,没有加上分号结尾。 新评论
我用“ObjectCreate”创建了个按钮,按钮名称 “button1”,在“ OnChartEven”事件里获取单击按钮事件结果报错,有谁知道怎么改吗?
报错内容:'button1' - undeclared identifier
implicit conversion from 'string' to 'number'
expression not boolean
')' - semicolon expected
代码如下:
void OnChartEvent(const int id, // 事件标识符
const long& lparam, // 事件长整型参量
const double& dparam, // 事件双精度型参量
const string& sparam // 事件字符串型参量
)
{
if(id==CHARTEVENT_OBJECT_CLICK)
{
Print("The mouse has been clicked on the object with name '"+sparam+"'");
if(button1=sparam)
{
Alert("你单击了按钮")
}
}
}