//*********************************************************
// Labwindows/cvi8.5 HotRing控件的使用
// szlihongtao
// 2010-06-16
// 参照 王建新的<Labwindows/cvi测试技术及工程应用> page77
// 稍有改写
//*********************************************************
#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;
//由面板控件Ring转化为Hot Ring控件
HotRing_ConvertFromRing (panelHandle, PANEL_HOTRING);
//设置按键超时时间为5秒
/*
Constant: ATTR_HOTRING_TIMEOUT
Data Type: double
Description: If this specified time (in seconds) passes with no
keypress, the commit event is sent and a new search is started.
*/
//超时时间为任意值,好像都可以自动匹配,不知道是什么原因??????
HotRing_SetAttribute (panelHandle, PANEL_HOTRING, ATTR_HOTRING_TIMEOUT, 0.0);
//设置键盘最大输入匹配字符为1个
HotRing_SetAttribute (panelHandle, PANEL_HOTRING, ATTR_HOTRING_MATCH_SIZE, 1);
// 当键盘最大输入匹配字符为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;
}
//*********************************************************
//*********************************************************
//*********************************************************
文章评论(0条评论)
登录后参与讨论