如何手动编辑CVI的头文件(*.h)
cvi的头文件*.h是自动生成的,摘录如下:#defineMain_PANEL 3
#defineMain_PANEL_S1_32 2
#defineMain_PANEL_S1_31 3
#defineMain_PANEL_S1_30 4
#defineMain_PANEL_S1_29 5
#defineMain_PANEL_S1_28 6
#defineMain_PANEL_S1_27 7
#defineMain_PANEL_S1_26 8
#defineMain_PANEL_S1_25 9
#defineMain_PANEL_Chn_32 10
#defineMain_PANEL_Chn_31 11
#defineMain_PANEL_Chn_30 12
#defineMain_PANEL_Chn_29 13
#defineMain_PANEL_Chn_28 14
#defineMain_PANEL_Chn_27 15
#defineMain_PANEL_Chn_26 16
#defineMain_PANEL_Chn_25 17
#defineMain_PANEL_CHECKBOX_29 18
#defineMain_PANEL_CHECKBOX_26 19
#defineMain_PANEL_CHECKBOX_32 20
#defineMain_PANEL_CHECKBOX_31 21
#defineMain_PANEL_CHECKBOX_30 22
#defineMain_PANEL_CHECKBOX_28 23
#defineMain_PANEL_CHECKBOX_27 24
#defineMain_PANEL_CHECKBOX_25 25
#defineMain_PANEL_S1_24 26
#defineMain_PANEL_S1_23 27
#defineMain_PANEL_S1_22 28
可以看到相同的控件定义不连续,现在我想手动按照下面的方式来定义,如:
#defineMain_PANEL 3
#defineMain_PANEL_S1_1 2
#defineMain_PANEL_S1_2 3
#defineMain_PANEL_S1_3 4
. .
. .
. .
#defineMain_PANEL_S1_30 31
#defineMain_PANEL_S1_31 32
#defineMain_PANEL_S1_32 33
#defineMain_PANEL_Chn_1 34
#defineMain_PANEL_Chn_2 35
#defineMain_PANEL_Chn_3 36
. .
. .
. .
#defineMain_PANEL_Chn_30 63
#defineMain_PANEL_Chn_31 64
#defineMain_PANEL_Chn_32 65
. .
. .
. .
这样定义后,在编程的时候就可以通过对控件句柄简单的加减计算来得到控件所在通道的编号.
但是为什么我手动可以修改,但只要我一改动主面板上任何一个控件的大小或者位置,然后保存,
头文件又恢复到原来的形式?不知道这是什么原因?还是我在设计面板的时候有什么不对的地
方?请高手多多指点! CVI自动产生的头文件是禁止修改的!而且它是根据面板编辑而成的,面板上的控件安放次序决定了它的句柄。
你要么重新布置相关控件(按照你要的连续放置);要么使用NewCtrl()函数在程序初始化时产生相关控件,这样可保证相应控件的句柄连续。
回复 2# netcreature 的帖子
谢谢斑竹!要修改的话确实比较麻烦! 不过是可以改的!在UIR状态下,选择:Edit→Tab Order 就可以修改!
"uir中的控件是按照TAB排序的, 这样在程序中可以使用数字的控件标识,来操作控件,使程序简洁些,但一旦uir做好以后,就不能再添加或删除控件,否则,排序会发生紊乱,但可以移动位置,因为并不改变标识和Tab顺序。若想增加控件,应尽量在Tab顺序后添加, 这样不影响以前的程序工作,方法是,打开uir文件添加控件后,在菜单EDIT, TAB_order来重新排序。"
这是俺师傅告诉俺的.帖出来和大家一起分享,希望对在学习中的朋友有帮助! 帮助太大啦,正找呢,谢谢啊。
页:
[1]