在Wincc中实现单按钮启动/停止。即按一下,按钮关联的变量置位为1,再按一下,变量复位为0。
#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
SetTagBit("BF01_CP_HMI_SevName_Play" ,!GetTagBit("BF01_CP_HMI_SevName_Play"));
}
#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)
{
#pragma option(mbcs)
if(GetTagBit("BF01_CP_HMI_SevName_Play")==1)
SetTagBit("BF01_CP_HMI_SevName_Play",0);
else if (GetTagBit("BF01_CP_HMI_SevName_Play")==0)
SetTagBit("BF01_CP_HMI_SevName_Play",1);
}