怎么获取获取按钮的单机时间?

 

我用“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("你单击了按钮")

          }

     }

 }    

 

108行要改成

if(StringCompare(sparam, "button1")==0)

110行那个Alert函数调用语句后面,没有加上分号结尾。

原因: