labwindowscvi2第三章 图形用户界面设计

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
int NewMenuItem (int Menu_Bar_Handle, int Menu_ID, char Item_Name[], int Before_Menu_Item_ID, int Short_Cut_Key, MenuCallbackPtr Event_Function, void *Event_Callback_Data); &menuFileOpenID = NewMenuItem (mainMenuHandle, menuFileID, "打开...", -1, 0, FileOpen, 0);
自动化测试与控制研究所
图形用户界面设计
1.
图形用户界面(Graphical User Interface)
面板(panel) 菜单条(menu bar) 控件(control) LabWindows/CVI自定义的资源格式
2.
面板设计
其它资源的容器 面板属性编辑器 使用用户界面设计函数创建面板和改变面板属性
NewSubMenu
int NewSubMenu (int Menu_Bar_Handle, int Menu_Item_ID); menuFileOpenID = NewSubMenu (mainMenuHandle, menuFileID);
DiscardMenu DiscardSubMenu DiscardMenuItem ……
DiscardMenuBar
int DiscardMenuBar (int Menu_Bar_Handle); DiscardMenuBar (mainMenuHandle);
NewMenuBar
int NewMenuBar (int Destination_Panel_Handle); mainMenuHandle = NewMenuBar (testPanelHandle);
2010-11-4
17/38
指示等(LED)
二值开关(Binary Switch)
2010-11-4
18/38
列表控件(Ring):下拉列表,滑动列表,图形列表
2010-11-4
19/38
列表框(List Box)
装饰控件(Decoration)
2010-11-4
20/38
图形控件(Graph):曲线图控件,带状图控件,数 字图控件
int InstallPopup (int Panel_Handle); InstallPopup (testPanelHandle);
RemovePopup
删除弹出式面板
int RemovePopup (int Remove_Popup); RemovePopup (0);
MessagePopup
2010-11-4
5/38
HidePanel
隐藏面板
int HidePanel (int Panel_Handle); HidePanel (testPanelHandle);
GetPanelAttribute
获取面板属性
int GetPanelAttribute (int Panel_Handle, int Panel_Attribute, void *Attribute_Value); GetPanelAttribute (testPanelHandle, ATTR_BACKCOLOR, &color);
SavePanelState RacallPanelState ……
2010-11-4
保存面板状态 调出面板状态
6/38
弹出式面板(Pop-up Panel)
2010-11-4
7/38
弹出式面板(Pop-up Panel)
2010-11-4
8/38
弹出式面板函数(Pop-up Panel)
InstallPopup 载入弹出式面板
画布控件(Canvas)
2010-11-4
26/38
表格控件(Table)
2010-11-4
27/38
分隔控件(Splitter)
2010-11-4
28/38
分页控件(Tab)
2010-11-4
29/38
定制控件(Custom Control)
2010-11-4
30/38
通用控件操作函数:
2010-11-4
10/38
3.
菜单条设计
简易菜单条和定制菜单条 菜单制作和编辑器 使用用户界面函数创建和编辑菜单
2010-11-4
11/38
菜单编辑窗口
2010-11-4
12/38
菜单操作函数:
LoadMenuBar
int LoadMenuBar (int Destination_Panel_Handle, char Filename[], int Menu_Bar_Resource_ID); mainMenuHandle = LoadMenuBar (testPanelHandle, "test.uir", MAIN_MENU);
DirSelectPopup
int DirSelectPopup (char Default_Directory[], char Title[], int Allow_Cancel?, int Allow_Make_Directory?, char Path_Name[]); i = DirSelectPopup ("c:\\vxipnp", "Select Directory", 1, 1, &pathname);
LabWindows/CVI教程 LabWindows/CVI教程(2) 教程(2)
用户图形界面设计
乔立岩
http://hitee.hit.edu.cn/531net/instrument Email: qiaoliyan@hit.edu.cn MSN: qiaoliyan@msn.com Tel: 86413532/33 ext. 526 Office: 科学园2A栋526 科学园2A栋
2010-11-4
2/38
面板(panel)
2010-11-4
Байду номын сангаас3/38
面板编辑窗口
2010-11-4
4/38
面板操作函数:
NewPanel 创建面板
int NewPanel (int Parent_Panel_Handle, char Panel_Title[], int Panel_Top, int Panel_Left, int Panel_Height, int Panel_Width); testPanelHandle = NewPanel (0, "新面板", 10, 10, 200, 300);
输出信息对话框
int MessagePopup (char Title[], char Message[]); MessagePopup ("提示信息", "测试结束,全部合格");
ConfirmPopup
等待确认对话框 Yes or No
int ConfirmPopup (char Title[], char Message[]); response = ConfirmPopup ("测试信息", "测量错误,是否继续?");
GetCtrlVal
int GetCtrlVal (int Panel_Handle, int Control_ID, void *Value); GetCtrlVal (testPanelHandle, NUMERIC_VOL, &voltage);
SetCtrlVal
int SetCtrlVal (int Panel_Handle, int Control_ID, ...); SetCtrlVal (testPanelHandle, NUMERIC_VOL, 5.0);
GetCtrlAttribute
int GetCtrlAttribute (int Panel_Handle, int Control_ID, int Control_Attribute, void *Attribute_Value); GetCtrlAttribute (testPanelHandle, NUMERIC_VOL, ATTR_CTRL_VAL, &voltage);
2010-11-4
14/38
4. 控件设计
控件种类:
数值型(Numeric):数值控件,颜色选择控件,数值滑动条
2010-11-4
15/38
文本型(Text):字符串控件,文本信息,文本框
2010-11-4
16/38
命令按钮(Command Button):命令按钮,图片按钮
双态按钮(Toggle Button):双态按钮,文本/图形按 钮,单选/复选控件
2010-11-4
9/38
FileSelectPopup
int FileSelectPopup (char Default_Directory[], char Default_File_Spec[], char File_Type_List[], char Title[], int Button_Label, int Restrict_Directory?, int Restrict_Extension?, int Allow_Cancel?, int Allow_Make_Directory?, char Path_Name[]); i = FileSelectPopup ("c:\\vxipnp", "*.txt", "*.*", "选择数据文件", VAL_LOAD_BUTTON, 0, 0, 1, 0, filename);
NewMenu
int NewMenu (int Menu_Bar_Handle, char Menu_Name[], int Before_Menu_ID); menuFileID = NewMenu (mainMenuHandle, "文件", -1);
2010-11-4
13/38
NewMenuItem
SetPanelAttribute
设置面板属性
int SetPanelAttribute (int Panel_Handle, int Panel_Attribute, ...); SetPanelAttribute (testPanelHandle, ATTR_BACKCOLOR, VAL_RED);
LoadPanel
载入面板
int LoadPanel (int Parent_Panel_Handle, char Filename[], int Panel_Resource_ID); testPanelHandle = LoadPanel (0, "test.uir", PANEL_TEST);
曲线图控件(Graph)
2010-11-4
21/38
带状图控件(Strip Chart)
2010-11-4
22/38
数字图控件(Digital Graph)
2010-11-4
23/38
图片控件(Picture)
2010-11-4
24/38
树形控件(Tree)
2010-11-4
25/38
定时器控件(Timer)
PromptPopup
等待输入字符信息对话框
int PromptPopup (char Title[], char Message[], char Response_Buffer[], int Max_Response_Length); PromptPopup ("输入信息", "请输入姓名", &name, 20);
WaveformGraphPopup
int WaveformGraphPopup (char Title[], void *Y_Array, int Number_of_Points, int Y_Data_Type, double Y_Gain, double Y_Offset, double Initial_X, double X_Increment); WaveformGraphPopup ("测量波形", testdata, 1024, VAL_DOUBLE, 1.0, 0.0, 0.0, 1.0);
DisplayPanel DiscardPanel
显示面板 释放面板
int DisplayPanel (int Panel_Handle); DisplayPanel (testPanelHandle); int DiscardPanel (int Panel_Handle) DiscardPanel (testPanelHandle);
相关文档
最新文档