[LabWindows_CVI测试技术及工程应用]4.1Hot Ring控件(学习杂记)
右键选择Custom Controls——〉Toolslib Controls——〉Hot Ring选项
具有键盘迅速定位功能,当控件被选定或者得到焦点时,用户可以通过设定匹配字符串和设定时间来快速选择要查询的选项。
跟以往重复的步骤不再啰嗦重复了......
1、产生用户界面

双击控件后编辑相关属性

2、产生并修改源代码(仅需添加红色部分两行代码搞定)
#include "hotringctrl.h"
#include <cvirte.h>
#include <userint.h>
#include "hotring.h"
static int panelHandle;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "hotring.uir", PANEL)) < 0)
return -1;
HotRing_ConvertFromRing (panelHandle, PANEL_HOTRING);//由面板控件Ring转化成Hot Ring控件
HotRing_SetAttribute(panelHandle, PANEL_HOTRING, ATTR_HOTRING_TIMEOUT, 5.0);//设置按键超时时间为5秒
HotRing_SetAttribute(panelHandle, PANEL_HOTRING, ATTR_HOTRING_MATCH_SIZE, 2);//设置键盘最大输入匹配字符为2个
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK QuitCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}