演示树控件Tree的使用.docVIP

  • 39
  • 0
  • 约4.78千字
  • 约 7页
  • 2017-12-22 发布于河南
  • 举报
演示树控件Tree的使用

演示树控件Tree的使用 /Upload/2010/6/10/402ee23b-eb3f-4ed4-9b54-88ef97a4f2ce.rar//********************************************************* // Labwindows/cvi8.5 演示树控件Tree的使用 // szlihongtao // 2010-06-10 // 参照 王建新的Labwindows/cvi测试技术及工程应用 page38 // 稍有改写 //********************************************************* #include formatio.h #include cvirte.h #include userint.h #include textlisttree.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, textlisttree.uir, PANEL)) 0) return -1; DisplayPanel (panelHandle); RunUserInterface (); DiscardPanel (panelHandle); return 0; } //********************************************************* //转移按钮的回调函数 //********************************************************* int CVICALLBACK transfer(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int maxitems; int i; char label[128]; char Tag[128]; int value; int f_checked; static int j=0,k; switch (event) { case EVENT_COMMIT: //清除指定列表框 { ClearListCtrl (panelHandle, PANEL_TREE); //清除控件的内容 InsertTextBoxLine (panelHandle, PANEL_TEXTBOX, -1, 转移并显示目录); //向文本框的末尾添加一行文本 GetNumListItems (panelHandle, PANEL_LISTBOX, maxitems); //获得列表框项目的数目 for (j=i=0;imaxitems;i++) { //获得列表框中指定项目的选中状态 IsListItemChecked (panelHandle, PANEL_LISTBOX, i, f_checked); //如果该项目被选中,则执行以下操作 if (f_checked) { j = j + 1; // 为什么要 +1 呢 ? GetValueFromIndex (panelHandle, PANEL_LISTBOX, i, value); //获得指定索引项目的value值 GetLabelFromIndex (panelHandle, PANEL_LISTBOX, i, label); //获得指定索引项目的标题 //将选中的

文档评论(0)

1亿VIP精品文档

相关文档