zhy2536 发表于 2005-9-14 22:43:53

关于控件属性设置,我觉得这个结果很奇怪

一个面板上有八个文本控件,分别显示四个轴的位置,速度,显示时我分开显示,即按一个显示位置的键时显示四个位置控件,按显示速度键时显示四个速度控件,属性设置部分程序如下:
int CVICALLBACK posdisplayerfun (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
{
switch (event)
    {
    case EVENT_COMMIT:
      
          SetCtrlAttribute (tempPanelHandle, TOPERATE_X_position, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_Y_position, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_A_position, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_B_position, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_XAXISVEL, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_YAXISVEL, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_AAXISVEL, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_BAXISVEL, ATTR_VISIBLE, 0);
      
      break;
    }
return 0;
}

int CVICALLBACK Jogparamdisplayerfun (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
{
switch (event)
    {
    case EVENT_COMMIT:
      
          SetCtrlAttribute (tempPanelHandle, TOPERATE_X_position, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_Y_position, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_A_position, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_B_position, ATTR_VISIBLE, 0);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_XAXISVEL, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_YAXISVEL, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_AAXISVEL, ATTR_VISIBLE, 1);
          SetCtrlAttribute (tempPanelHandle, TOPERATE_BAXISVEL, ATTR_VISIBLE, 1);
      
      
   
      break;
    }
return 0;
}
可是运行时报错了
531, 70 Illegal expression.
531, 72 syntax error; found 'integer constant' expecting ')'.
531, 72 Insufficient number of arguments to `SetCtrlAttribute'.
531, 72 syntax error; found 'integer constant' expecting ';'.
531, 87 syntax error; found ')' expecting ';'.
531, 87 Illegal statement termination.
很奇怪的是报错的只有设置显示速度的那几条语句,显示位置的很正常,为什么一样的控件,一样的语句,结果不一样呢?

game216 发表于 2005-9-14 23:29:21

<P>好着的阿</P><P>我把你的代码调试了一下</P><P>显示很正常</P><P>是不是什么地方犯了低级错误了</P>

zhy2536 发表于 2005-9-14 23:34:26

<P>呵呵,不好意思,这个问题已经解决了,我改了源程序但是头文件没有重新生成</P><P>我是个新手,让你见笑了</P><P>谢谢你了!</P>

zhy2536 发表于 2005-9-14 23:38:58

<P>我以为头文件只要自己相应的改一下就可以了,原来不行哦,它后面的序号都必须自己生成,不能自己想当然去改,希望各位新手不要犯我这种低级错误。</P><P>看样子我还有很多东西要学哦</P>
页: [1]
查看完整版本: 关于控件属性设置,我觉得这个结果很奇怪