程序如下
#include "apdefap.h"
long _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
int iProcess;
iProcess=GetTagWord("test");
switch(iProcess)
{
case 1:SetPropWord(lpszPictureName,"选项组2","Process",1); //Return-Type: BOOL
break;
case 2:SetPropWord(lpszPictureName,"选项组2","Process",2); //Return-Type: BOOL
break;
case 3:SetPropWord(lpszPictureName,"选项组2","Process",4); //Return-Type: BOOL
break;
case 4:SetPropWord(lpszPictureName,"选项组2","Process",8); //Return-Type: BOOL
break;
default:SetPropWord(lpszPictureName,"选项组2","Process",0); //Return-Type: BOOL
}
return 0;
}
为什么选项组界面什么都不显示啊?
最佳答案
中间的代码倒像是没什么问题,从long _main可以看出你的脚本放到了某个对象的“属性”事件中,应该是触发条件没有设置好吧。
将以代码移植到按钮事件中进行测试:
int iProcess;
iProcess=GetTagWord("test");
switch(iProcess)
{
case 1:SetPropWord(lpszPictureName,"选项组2","Process",1); //Return-Type: BOOL
break;
case 2:SetPropWord(lpszPictureName,"选项组2","Process",2); //Return-Type: BOOL
break;
case 3:SetPropWord(lpszPictureName,"选项组2","Process",4); //Return-Type: BOOL
break;
case 4:SetPropWord(lpszPictureName,"选项组2","Process",8); //Return-Type: BOOL
break;
default:SetPropWord(lpszPictureName,"选项组2","Process",0); //Return-Type: BOOL
}
如正常则说明是触发条件设置有问题。如执行后有问题则说明是代码本身的问题,检查变量test是否正确,以及选项组名是否为"选项组2"等等。
提问者对于答案的评价:
非常感谢,已经解决
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc271960.html