int CVICALLBACK pFunctions (int panel, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_KEYPRESS: if(eventData1 == VAL_END_VKEY) // Escape == Panel schliessen { if(panel != pBasicFn) HidePanel(panel); } break; case EVENT_CLOSE: if (panel == pSystem) HidePanel(pSystem); if (panel == pBasicFn) { PiCardFnct (PI_HOME); QuitUserInterface(0); } if (panel == pControlPad) HidePanel(pControlPad); break; } return 0; }
int CVICALLBACK PBExit (int panel, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_CLOSE: WriteLog(); KillSubprocess(); QuitUserInterface (0); if (panelHandle) { DiscardPanel (panelHandle); } if (configHandle) { DiscardPanel(configHandle); } if (itemHandle) { DiscardPanel(itemHandle); } break; } return 0; }
void utilG_Init (void (*DiscardPanels)(void)) { int p, control, top, height, width; int grw, chw, asw, acw; utilG.acq.pt = 0; utilG.acq.nPts = 0; utilG.acq.status = ACQ_NONE; utilG.p = LoadPanel (0, "utilu.uir", BG); utilG.DiscardPanels = DiscardPanels; SetPanelAttribute (utilG.p, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE); DisplayPanel (utilG.p); GetCtrlAttribute(utilG.p, BG_GRAPHS, ATTR_WIDTH, &grw); GetCtrlAttribute(utilG.p, BG_CHANNELS, ATTR_WIDTH, &chw); GetCtrlAttribute(utilG.p, BG_ACQSETUP, ATTR_WIDTH, &asw); GetCtrlAttribute(utilG.p, BG_ACQCHANNELS, ATTR_WIDTH, &acw); GetPanelAttribute(utilG.p, ATTR_WIDTH, &width); SetCtrlAttribute(utilG.p, BG_GRAPHS, ATTR_LEFT, (3*width/20) - grw); SetCtrlAttribute(utilG.p, BG_CHANNELS, ATTR_LEFT, (7*width/20) - chw); SetCtrlAttribute(utilG.p, BG_ACQSETUP, ATTR_LEFT, (9*width/15) - asw); SetCtrlAttribute(utilG.p, BG_ACQCHANNELS, ATTR_LEFT, (9*width/10) - acw); initP = LoadPanel (utilG.p, "utilu.uir", INIT); SetPanelPos (initP, VAL_AUTO_CENTER, VAL_AUTO_CENTER); SetCtrlAttribute (initP, INIT_TEXT, ATTR_VISIBLE, FALSE); DisplayPanel (initP); GetUserEvent (1, &p, &control); switch (control) { case INIT_CONTROL: utilG.acq.status = ACQ_DONE; break; case INIT_ANALYSIS: utilG.acq.status = ACQ_NONE; break; case INIT_EXIT: utilG_Exit(); QuitUserInterface(0); exit (EXIT_SUCCESS); break; } SetMouseCursor (VAL_HOUR_GLASS_CURSOR); SetCtrlAttribute (initP, INIT_TEXT, ATTR_VISIBLE, TRUE); SetCtrlAttribute (initP, INIT_TEXT_10, ATTR_VISIBLE, FALSE); SetCtrlAttribute (initP, INIT_CONTROL, ATTR_VISIBLE, FALSE); SetCtrlAttribute (initP, INIT_ANALYSIS, ATTR_VISIBLE, FALSE); SetCtrlAttribute (initP, INIT_EXIT, ATTR_VISIBLE, FALSE); GetCtrlAttribute (initP, INIT_TEXT, ATTR_TOP, &top); GetCtrlAttribute (initP, INIT_TEXT, ATTR_HEIGHT, &height); SetPanelAttribute (initP, ATTR_HEIGHT, top+height+6); util_ChangeInitMessage ("DAAS Utilities..."); }
int CVICALLBACK Quit_Btn_Callback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: QuitUserInterface (0); break; } return 0; }
int BGDoneCallback(int panel, int event, void *callbackData, int eventData1, int eventData2) { if (event == EVENT_CLOSE) if (ConfirmPopup ("Exit DAAS?", "Are you so sure you want to exit DAAS?")) { //utilG.DiscardPanels(); QuitUserInterface(0); /* user selected "Exit" from the menu */ exit(0); } return 0; }
int CVICALLBACK quit_button_hit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { if (event!=EVENT_COMMIT) return 0; //Close COM Port RS232_Close(); //Close GUI QuitUserInterface (0); return 0; }
int CVICALLBACK clbExit (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: SaveFileAs( 1 , 1 ); QuitUserInterface (0); break; } return 0; }
int CVICALLBACK quitbutton (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: pause_flag=0; i=Nscans; SRS_flag=0; SRS_onoff(); QuitUserInterface (0); break; } return 0; }
/** @brief This function initializes the panel @param panel the panel handle of the panel on which the button is used @param event the type of event generated (i.e. left-click causes EVENT_COMMIT) @param *callbackData stores the data returned to the UI handled internally by LabWindows @param eventData1 stores ancillary information such as the mouse x-position within the panel @param eventData2 stores ancillary information such as the mouse y-position within the panel @return 1 or 0 specifies whether or not the event should be swallowed. 0 is default-no and 1 is yes-swallow. ### EXTERNAL VARIABLES - extern OpenPETTree @ref current_location - "UI_Common.c" - extern OpenPETSysConfig @ref sys_config - "UI_Common.c" ### ABNORMAL TERMINATION CONDITIONS, ERROR AND WARNING MESSAGES Errors may be generated by CVI/LabWindows. The LabWindows documentation is available online at <a href="linkURL"> http://zone.ni.com/reference/en-XX/help/370051V-01/ </a>. ### ALGORITHM The panel is initialized when the panel receives focus. To initialize, the panel title, tree control, and active items must be updated. The panel title is updated first. Next, the tree control is updated by inserting each DB as a DUC child, each DUC as a MB child, and each MB as a CUC child. The CUC is already present by default. Each item inserted is given a tag (i.e. MB0, MB0DUC1, or MB0DUC1DB2). These tags allow them to be reached in the future. The tree is collapsed as needed to show only the relevant items. If the tree has already been created, it is simply collapsed to show only the relevant items. Every other control is updated to display relevant information. ### DEVELOPMENT HISTORY Date | Author | Email Address | Ver. |Description Of Change --------|-----------------|--------------------|------|--------------------- 08/09/2013| George Netscher | [email protected] | 1.0 |conclusion of summer work ### Copyright (c) 2013 by LBNL. All Rights Reserved. */ int CVICALLBACK InitializeFloodMapMode (int panel, int event, void *callbackData, int eventData1, int eventData2) { char title_string[50]; char item_label_root[15], item_label[15],item_label_MB[5], item_label_DUC[5], item_label_DB[5], temp_string[10]; int idx_MB, idx_DUC, idx_DB, i, j, k; int num_items=1; int current_boards[3], idx=0; int notInitializedFlag=0; // 1 if panel needs to be initialized char filepath[260]; // max allowed by Windows OS int *floodmap_array; int rows, columns; switch (event) { case EVENT_GOT_FOCUS: switch(current_location.mode) { case OSCILLOSCOPE: sprintf (title_string, "Oscilloscope Mode "); break; case TEST1: sprintf (title_string, "Test Mode 1 "); break; case TEST2: sprintf (title_string, "Test Mode 2 "); break; case ENERGY: sprintf (title_string, "Energy Mode "); break; case FLOODMAP: sprintf (title_string, "Flood Map Mode "); break; case TIME: sprintf (title_string, "Time Mode "); break; case USER: sprintf (title_string, "User Mode "); break; } if(current_location.MB != -1) { sprintf(temp_string, "- MB%d ", current_location.MB); strcat(title_string, temp_string); } if(current_location.DUC != -1) { sprintf(temp_string, "DUC%d ", current_location.DUC); strcat(title_string, temp_string); } SetPanelAttribute (panel, ATTR_TITLE, title_string); // populate instrument tree FillTreeControl( panel, FMMODE_TREE); // read data file DetermineFolderPath(filepath, "C:\\Documents and Settings\\OpenPET\\My Documents\\GitHub\\HostPC\\GUI\\Example file structure\\REPORT_data_07162013_floodmap\\"); sprintf(temp_string, "DB%d\\", 1); strcat(filepath, temp_string); // will eventually cycle through each DB and display appropriate information strcat(filepath, "FloodMapMode_Block0.txt"); // will eventually cycle through each text file and dispay appropriate information DetermineArraySize(filepath, &rows, &columns); //ReadArrayFromFile(filepath, floodmap_array); //SetActiveCtrl(panel, FMMODE_TREE); break; case EVENT_LOST_FOCUS: break; case EVENT_CLOSE: QuitUserInterface (0); break; } return 0; }
void CVICALLBACK clbMenuExit (int menuBar, int menuItem, void *callbackData, int panel) { SaveFileAs( 1 , 1 ); QuitUserInterface (0); }
/** @brief This function initializes the panel @param panel the panel handle of the panel on which the button is used @param event the type of event generated (i.e. left-click causes EVENT_COMMIT) @param *callbackData stores the data returned to the UI handled internally by LabWindows @param eventData1 stores ancillary information such as the mouse x-position within the panel @param eventData2 stores ancillary information such as the mouse y-position within the panel @return 1 or 0 specifies whether or not the event should be swallowed. 0 is default-no and 1 is yes-swallow. ### EXTERNAL VARIABLES - extern OpenPETTree @ref current_location - "UI_Common.c" - extern OpenPETSysConfig @ref sys_config - "UI_Common.c" ### ABNORMAL TERMINATION CONDITIONS, ERROR AND WARNING MESSAGES Errors may be generated by CVI/LabWindows. The LabWindows documentation is available online at <a href="linkURL"> http://zone.ni.com/reference/en-XX/help/370051V-01/ </a>. ### ALGORITHM The panel is initialized when the panel receives focus. To initialize, the panel title, tree control, and active items must be updated. The panel title is updated first. Next, the tree control is updated by inserting each DB as a DUC child, each DUC as a MB child, and each MB as a CUC child. The CUC is already present by default. Each item inserted is given a tag (i.e. MB0, MB0DUC1, or MB0DUC1DB2). These tags allow them to be reached in the future. The tree is collapsed as needed to show only the relevant items. If the tree has already been created, it is simply collapsed to show only the relevant items. Every other control is updated to display relevant information. ### DEVELOPMENT HISTORY Date | Author | Email Address | Ver. |Description Of Change --------|-----------------|--------------------|------|--------------------- 08/09/2013| George Netscher | [email protected] | 1.0 |conclusion of summer work ### Copyright (c) 2013 by LBNL. All Rights Reserved. */ int CVICALLBACK InitializeTimeMode (int panel, int event, void *callbackData, int eventData1, int eventData2) { char title_string[50]; char item_label_root[15], item_label[15],item_label_MB[5], item_label_DUC[5], item_label_DB[5], temp_string[10]; int idx_MB, idx_DUC, idx_DB, i, j, k; int num_items=1; int current_boards[3], idx=0; int notInitializedFlag=0; // 1 if panel needs to be initialized switch (event) { case EVENT_GOT_FOCUS: switch(current_location.mode) { case OSCILLOSCOPE: sprintf (title_string, "Oscilloscope Mode "); break; case TEST1: sprintf (title_string, "Test Mode 1 "); break; case TEST2: sprintf (title_string, "Test Mode 2 "); break; case ENERGY: sprintf (title_string, "Energy Mode "); break; case FLOODMAP: sprintf (title_string, "Flood Map Mode "); break; case TIME: sprintf (title_string, "Time Mode "); break; case USER: sprintf (title_string, "User Mode "); break; } if(current_location.MB != -1) { sprintf(temp_string, "- MB%d ", current_location.MB); strcat(title_string, temp_string); } if(current_location.DUC != -1) { sprintf(temp_string, "DUC%d ", current_location.DUC); strcat(title_string, temp_string); } if(current_location.DB != -1) { sprintf(temp_string, "DB%d ", current_location.DB); strcat(title_string, temp_string); } SetPanelAttribute (panel, ATTR_TITLE, title_string); // populate instrument tree FillTreeControl( panel, TIMEMODE_TREE); //SetActiveCtrl(panel, TIMEMODE_TREE); break; case EVENT_LOST_FOCUS: break; case EVENT_CLOSE: QuitUserInterface (0); break; } return 0; }
/* 菜单栏-关闭系统主界面,退出系统 */ void CVICALLBACK menu_Exit(int menuBar, int menuItem, void *callbackData,int panel){ stopDataAcq(); QuitUserInterface (0); }