- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
LabWindows/CVI虚拟仪器设计技术基本控件使用之:Ring 箭头设置
(2)程序源代码
//头文件声明
#include <cvirte.h>
#include <userint.h>
#include "Ring 箭头设置.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, "Ring 箭头设置.uir", PANEL)) < 0)
return –1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
} //面板回调函数
int CVICALLBACK PanelCB (int panel, int event, void *callbackData,
int eventData1, int eventData2)
{
switch (event)
{
case EVENT_CLOSE:
QuitUserInterface (0);
break;
}
return 0;
}
?//Ring 控件
int CVICALLBACK arrow (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{ //定义箭头的宽度或高度
int style; //定义箭头的数值
int value;
switch (event)
{
case EVENT_COMMIT:
// 判断设置箭头的宽度或高度
GetCtrlVal (panelHandle, PANEL_BINARYSWITCH, &style);
// 当设置箭头属性为宽度时
if (style == 0)
{ // 判断响应哪一控件事件
switch (control)
{ // 普通Ring 控件
case PANEL_RING_PLAIN:
GetCtrlVal (panelHandle, control, &value);
SetCtrlAttribute (panel, control, 20472, value);
break;
//Menu Ring 控件
case PANEL_RING_MENU:
GetCtrlVal (panelHandle, control, &value);
SetCtrlAttribute (panel, control, 20475, value);
break;
//Recessed Menu Ring 控件
case PANEL_RING_RECESSEDMENU:
GetCtrlVal (panelHandle, control, &value);
SetCtrlAttribute (panel, control, 20475, value);
break;
//Popup Menu Ring 控件
case PANEL_RING_POPUPMENU:
GetCtrlVal (panelHandle, control, &value);
SetCtrlAttribute (panel, control, 20475, value);
break;
}
} // 当设置箭头属性为高度时
else
{ // 普通Ring 控件不能设置高度属性
if (control != PANEL_RING_PLAIN)
? {
GetCtrlVal (panelHandle, control, &value);
SetCtrlAttribute (panel, control, 20476, value);
}
}
break;
}
return 0;
}
上一篇:LabWindows/CVI虚拟仪器设计技术基本控件使用之:
Tab
控件
下一篇:LabWindows/CVI虚拟仪器设计技术场景与游戏设计之:
移动控件