[LabWindows_CVI測(cè)試技術(shù)及工程應(yīng)用]4.1Hot Ring控件(學(xué)習(xí)雜記)
右鍵選擇Custom?Controls——〉Toolslib?Controls——〉Hot?Ring選項(xiàng)
具有鍵盤迅速定位功能,當(dāng)控件被選定或者得到焦點(diǎn)時(shí),用戶可以通過設(shè)定匹配字符串和設(shè)定時(shí)間來快速選擇要查詢的選項(xiàng)。
跟以往重復(fù)的步驟不再啰嗦重復(fù)了......
1、產(chǎn)生用戶界面

雙擊控件后編輯相關(guān)屬性

2、產(chǎn)生并修改源代碼(僅需添加紅色部分兩行代碼搞定)
#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轉(zhuǎn)化成Hot Ring控件
HotRing_SetAttribute(panelHandle, PANEL_HOTRING, ATTR_HOTRING_TIMEOUT, 5.0);//設(shè)置按鍵超時(shí)時(shí)間為5秒
HotRing_SetAttribute(panelHandle, PANEL_HOTRING, ATTR_HOTRING_MATCH_SIZE, 2);//設(shè)置鍵盤最大輸入匹配字符為2個(gè)
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;
}