cpubbs论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

LabVIEW+单片机学习套件全套教程资料下载[免费]LabVIEW论坛精华列表贴USB0816数据采集卡《LabVIEW宝典》
LabWindows/CVI论坛精华贴NET0816以太网数据采集卡RC0210远程设备授权系统 关闭关停锁定打开设备 户外分布式数据采集
NET1624低速高精度以太网数据采集卡WIFI0824SD无线WIFI网络数据采集卡脱机运行 SD存储 小尺寸微型 串口采集远程采集 安卓 手持移动采集 纪录仪
查看: 1810|回复: 3

如何手动编辑CVI的头文件(*.h)

[复制链接]
发表于 2008-11-11 09:23:15 | 显示全部楼层 |阅读模式
cvi的头文件*.h是自动生成的,摘录如下:
#define  Main_PANEL                                     3      
#define  Main_PANEL_S1_32                         2      
#define  Main_PANEL_S1_31                         3      
#define  Main_PANEL_S1_30                         4      
#define  Main_PANEL_S1_29                         5      
#define  Main_PANEL_S1_28                         6      
#define  Main_PANEL_S1_27                         7      
#define  Main_PANEL_S1_26                         8      
#define  Main_PANEL_S1_25                         9      
#define  Main_PANEL_Chn_32                      10      
#define  Main_PANEL_Chn_31                      11     
#define  Main_PANEL_Chn_30                      12      
#define  Main_PANEL_Chn_29                      13     
#define  Main_PANEL_Chn_28                      14      
#define  Main_PANEL_Chn_27                      15      
#define  Main_PANEL_Chn_26                      16     
#define  Main_PANEL_Chn_25                      17      
#define  Main_PANEL_CHECKBOX_29          18     
#define  Main_PANEL_CHECKBOX_26          19      
#define  Main_PANEL_CHECKBOX_32          20      
#define  Main_PANEL_CHECKBOX_31          21      
#define  Main_PANEL_CHECKBOX_30          22      
#define  Main_PANEL_CHECKBOX_28          23      
#define  Main_PANEL_CHECKBOX_27          24      
#define  Main_PANEL_CHECKBOX_25          25     
#define  Main_PANEL_S1_24                        26      
#define  Main_PANEL_S1_23                        27     
#define  Main_PANEL_S1_22                        28      

  可以看到相同的控件定义不连续,现在我想手动按照下面的方式来定义,如:

#define  Main_PANEL                                   3      
#define  Main_PANEL_S1_1                         2      
#define  Main_PANEL_S1_2                         3      
#define  Main_PANEL_S1_3                         4   
              .                                                       .
              .                                                       .
              .                                                       .
#define  Main_PANEL_S1_30                        31      
#define  Main_PANEL_S1_31                        32     
#define  Main_PANEL_S1_32                        33  
#define  Main_PANEL_Chn_1                        34     
#define  Main_PANEL_Chn_2                        35
#define  Main_PANEL_Chn_3                        36
              .                                                       .
              .                                                       .
              .                                                       .

#define  Main_PANEL_Chn_30                    63     
#define  Main_PANEL_Chn_31                    64     
#define  Main_PANEL_Chn_32                    65
              .                                                       .
              .                                                       .
              .                                                       .
  这样定义后,在编程的时候就可以通过对控件句柄简单的加减计算来得到控件所在通道的编号.
但是为什么我手动可以修改,但只要我一改动主面板上任何一个控件的大小或者位置,然后保存,
头文件又恢复到原来的形式?不知道这是什么原因?还是我在设计面板的时候有什么不对的地
方?请高手多多指点!
发表于 2008-11-11 12:35:24 | 显示全部楼层
CVI自动产生的头文件是禁止修改的!而且它是根据面板编辑而成的,面板上的控件安放次序决定了它的句柄。
你要么重新布置相关控件(按照你要的连续放置);要么使用NewCtrl()函数在程序初始化时产生相关控件,这样可保证相应控件的句柄连续。
 楼主| 发表于 2008-11-11 13:10:34 | 显示全部楼层

回复 2# netcreature 的帖子

谢谢斑竹!要修改的话确实比较麻烦! 不过是可以改的!

  在UIR状态下,选择:Edit→Tab Order 就可以修改!
  "uir中的控件是按照TAB排序的, 这样在程序中可以使用数字的控件标识,来操作控件,使程序简洁些,但一旦uir做好以后,就不能再添加或删除控件,否则,排序会发生紊乱,但可以移动位置,因为并不改变标识和Tab顺序。若想增加控件,应尽量在Tab顺序后添加, 这样不影响以前的程序工作,方法是,打开uir文件添加控件后,在菜单EDIT, TAB_order来重新排序。"
  这是俺师傅告诉俺的.帖出来和大家一起分享,希望对在学习中的朋友有帮助!

评分

参与人数 1经验 +5 收起 理由
netcreature + 5 我很赞同

查看全部评分

发表于 2008-11-11 13:26:43 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|cpubbs论坛. ( 粤ICP备09171248号 )

GMT+8, 2025-4-20 12:57 , Processed in 0.958001 second(s), 11 queries , Gzip On, File On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表