int CreateProgressPanel ( char* szMainTitle , int iNumberOfBars )
{
	int					hPanelWait					=	0; 
	
	if (( iNumberOfBars > WAIT_MAX_BARS ) || ( iNumberOfBars < 1 ))
		return -1;
	
	hPanelWait = LoadPanel ( 0 , "database.uir" , PROGRESS );
	
	if ( hPanelWait < 1 )
		return -1;
	
	if ( szMainTitle != NULL )
		SetPanelAttribute ( hPanelWait , ATTR_TITLE , szMainTitle );
	
	SetPanelAttribute ( hPanelWait , ATTR_HEIGHT , WAIT_BAR_START + ( WAIT_BAR_STEP * iNumberOfBars ) );
		
	InstallPopup (hPanelWait);
	
	MakeApplicationActive ();
	SetActivePanel ( hPanelWait );
	ProcessDrawEvents();

	return hPanelWait;
}
Exemple #2
0
int CVICALLBACK ConfigCMD (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			 DimAction(1);
			  WriteLog();
			  ResetTextBox (panelHandle, PANEL_TEXTBOX, "");
		
			if (ReadConfigFile(BBUCOMMON_CONFIGCMD))
			{
				if (0==InstallPopup(configHandle))
				{
					SetPanelAttribute (configHandle, ATTR_TITLE, "CheckCMD");    
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_ENTER_IS_NEWLINE, 1);
					SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_TEXT_BGCOLOR, VAL_OFFWHITE);
				}
			}
			else
			{
				SetCtrlVal (panelHandle, PANEL_TEXTBOX, "Read data from cmd.txt error,please check it by manual!\r\n");
			}
					
		
			  DimAction(0);   
			break;
	}
	return 0;
}
/* 按钮-Config-打开配置端口面板 */
int CVICALLBACK Config_Com_Btn(int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2) {
	switch(event){
		case EVENT_COMMIT:
			int popConfigPanel = LoadPanel(0, "MainPanel.uir", ConfigP);
			InstallPopup(popConfigPanel);
			break;
	}
	return 0;
}
Exemple #4
0
//////////////////////////////////////////manualbar callback function/////////////////////////////////////////////////
void CVICALLBACK Config (int menuBar, int menuItem, void *callbackData,
		int panel)
{
			  DimAction(1);
			  WriteLog();
			  ResetTextBox (panelHandle, PANEL_TEXTBOX, "");
			  switch (menuItem)
			  {
			  	case MENUBAR_CONFIG_CONFIGIP:
					if (ReadConfigFile(MENUBAR_CONFIG_CONFIGIP))
					{
						if (0==InstallPopup(configHandle))
						{
							SetPanelAttribute (configHandle, ATTR_TITLE, "CheckBBUIP");
							SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_ENTER_IS_NEWLINE, 1);
							SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_TEXT_BGCOLOR, VAL_OFFWHITE);
						}
					
					}
					else
					{
						SetCtrlVal (panelHandle, PANEL_TEXTBOX, "Read data from bbuip.txt error,please check it by manual!\r\n");        
					}
					break;
				case BBUCOMMON_CONFIGCMD:
					if (ReadConfigFile(BBUCOMMON_CONFIGCMD))
					{
						if (0==InstallPopup(configHandle))
						{
							SetPanelAttribute (configHandle, ATTR_TITLE, "CheckCMD");    
							SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_ENTER_IS_NEWLINE, 1);
							SetCtrlAttribute (configHandle, CONFIG_BOX, ATTR_TEXT_BGCOLOR, VAL_OFFWHITE);
						}
					}
					else
					{
						SetCtrlVal (panelHandle, PANEL_TEXTBOX, "Read data from cmd.txt error,please check it by manual!\r\n");
					}
					
			  }
			  DimAction(0);   
}  
int __declspec(dllexport) __stdcall EditClassPath(CAObjHandle context)
{
    int         error       = 0;
    int         canceled    = 0;                      
    ERRORINFO   errorInfo;
    ErrMsg      errMsg      = "";
    CAObjHandle stepH       = 0;
    CAObjHandle seqFileH    = 0;
    TSModalData modalData   = InitialModalData;

    // Save the context for later reference
    seqContext = context;
  
    // Load the UI panel
    if ((panelHandle = LoadPanelEx (0, "JavaCall.uir", PANEL, __CVIUserHInst)) < 0)
        return -1;

    // Get current step object from sequence context
    tsErrChk(TS_SeqContextGetStep (context, &errorInfo, &stepH));
    
    // Transfer class path from properties of the Java step to the CVI user interface
    tsErrChk(TS_SetCtrlToPropertyVal (stepH, "ClassPath", panelHandle, PANEL_JAVA_CLASSPATH));

    // Start the UI
    tsErrChk (TS_StartModalDialog(context, &errorInfo, &modalData));
    errChk (InstallPopup (panelHandle));
    errChk (canceled = RunUserInterface());

    if (!canceled) 
    {
        TS_SetPropertyToCtrlValEx (panelHandle, PANEL_JAVA_CLASSPATH, stepH, "ClassPath", errMsg);
        // Update the sequence file change count
        TS_SeqContextGetSequenceFile (context, &errorInfo, &seqFileH);
        tsErrChk(TS_SeqFileIncChangeCount (seqFileH, &errorInfo));
    }

Error:  

    // Discard the panels loaded 
    if (panelHandle > 0)
        TS_EndModalDialogAndDiscard (&errorInfo, &modalData, panelHandle);
    
    if (stepH)
        CA_DiscardObjHandle (stepH);
    if(seqFileH)
        CA_DiscardObjHandle (seqFileH);

    // If an error occurred, set the error flag to cause a run-time error in TestStand.
    if (error < 0)
        TS_SetStepError(context, error, errMsg);     
        
    return error;
}
Exemple #6
0
void CVICALLBACK ConfigItem (int menuBar, int menuItem, void *callbackData,
		int panel)
{
	 if((Initial(1, 0)>=0) && (Initial(2, 0)>=0) && (Initial(3, 0)>=0))
	 {
	 	InstallPopup(itemHandle);
	 }
	 else
	 {
	     SetLed("Read file type or filter information from config.ini to UI error,please try again!",0); 
	 }
	 
}
Exemple #7
0
void InitDecimateCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", DECIMATE);
    
    util_InitClose (chanfunc.p, DECIMATE_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, DECIMATE_CHANNELS);

    InstallPopup (chanfunc.p);
}
Exemple #8
0
void InitExponentCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", EXPONENT);
    
    util_InitClose (chanfunc.p, EXPONENT_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, EXPONENT_CHANNELS);

    InstallPopup (chanfunc.p);
}
Exemple #9
0
void InitSubsetCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    channelPtr chan;
    channel_InitViewPanel();
    chan = channellist_GetSelection();
    channel_UpdateViewPanel(chan);
    SetCtrlAttribute (chanview.p1, CHANVIEW_CHANNELS, ATTR_CTRL_MODE,
                      VAL_INDICATOR);
    InstallCtrlCallback (chanview.p1, CHANVIEW_DONE, SubsetDoneCallback,
                         chan);
    InstallPopup (chanview.p1);
    MessagePopup ("Subset Channel Message",
                  "Place window over desired readings"
                  " and press DONE to create subset");
}
Exemple #10
0
void InitManipulateCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i, height1, height2;
    channelPtr chan;

    channel_InitViewPanel();
    InstallCtrlCallback (chanview.p1, CHANVIEW_CHANNELS,
                         ManipulateSelectionCallback, 0);
    ClearListCtrl (chanview.p1, CHANVIEW_CHANNELS);
    for (i = 0; i < channelG.channels.nItems; i++)
    {
        chan = channellist_GetItem (i);
        if (!chan->curves.nItems)
            InsertListItem (chanview.p1, CHANVIEW_CHANNELS, -1, chan->label, i);
    }

    SetCtrlIndex (chanview.p1, CHANVIEW_CHANNELS, 0);
    GetCtrlVal (chanview.p1, CHANVIEW_CHANNELS, &i);
    chan = channellist_GetItem (i);
    InstallCtrlCallback (chanview.p1, CHANVIEW_GRAPH,
                         ManipulateGraphCallback, chan);

    channel_UpdateViewPanel(chan);

    SetCtrlAttribute (chanview.p1, CHANVIEW_GRAPH, ATTR_CTRL_MODE,
                      VAL_HOT);
    SetCtrlAttribute (chanview.p1, CHANVIEW_GRAPH, ATTR_NUM_CURSORS, 1);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1, ATTR_CURSOR_MODE,
                        VAL_SNAP_TO_POINT);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1,
                        ATTR_CROSS_HAIR_STYLE, VAL_SHORT_CROSS);
    SetCursorAttribute (chanview.p1, CHANVIEW_GRAPH, 1, ATTR_CURSOR_COLOR,
                        VAL_YELLOW);
    GetPanelAttribute (chanview.p1, ATTR_HEIGHT, &height1);

    chanview.p2 = LoadPanel (chanview.p1, "chanfncu.uir", MANIP);
    
    GetPanelAttribute (chanview.p2, ATTR_HEIGHT, &height2);
    SetPanelAttribute (chanview.p1, ATTR_HEIGHT, height1+height2+6);
    SetPanelPos (chanview.p2, height1, 6);

    InstallCtrlCallback (chanview.p2, MANIP_READING,
                         ManipulateReadingCallback, chan);

    DisplayPanel (chanview.p2);
    InstallPopup (chanview.p1);
    MessagePopup ("Manipulate Channel Message", "Only channels not connected to a curve may be edited");
}
Exemple #11
0
int util_OpenFile(char *path, int action, int ascii)
{
    int handle;
    unsigned int  nBytes, pos, width;
    long size;
    char info[256];

    if (action == FILE_WRITE) {
        handle = OpenFile (path, FILE_WRITE, 0, ascii);
        if (!ascii) FmtFile (handle, "BINARY\n");
    }
    else {
        handle = OpenFile (path, action, 0, 0);
        nBytes = ReadLine (handle, info, 255);
        if (CompareBytes (info, 0, "BINARY", 0, 6, 0) != 0) {
            CloseFile (handle);
            handle = OpenFile (path, action, 0, 1);
            ascii = TRUE;
        }
    }
	if(handle)
    {
		fileP = LoadPanel (0, "utilu.uir", FILESTAT);

    	

    	if (action == FILE_WRITE) {
        	Fmt (info, "Saving file: %s", path);
        	if (ascii) Fmt (info, "%s[a]< (ASCII file...go for coffee!)");
    	} else {
        	GetFileSize (path, &size);
        	Fmt (info, "Loading file: %s (%i kB)", path, size/1000);
        	if (ascii) Fmt (info, "%s[a]< (ASCII file...take a nap!)");
    	}

    	SetCtrlVal (fileP, FILESTAT_TEXT, info);
    	GetCtrlAttribute (fileP, FILESTAT_TEXT, ATTR_WIDTH, &width);
    	SetPanelAttribute (fileP, ATTR_WIDTH, width+12);
    	SetCtrlAttribute (fileP, FILESTAT_TEXT, ATTR_LEFT, 6);

    	SetPanelPos (fileP, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    	InstallPopup (fileP);
	}
	else
		handle = 0;
	return handle;
}
Exemple #12
0
void InitAddChannelsCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanops.p = LoadPanel (0, "chanopsu.uir", CHANOPS_1);
    
    util_InitClose (chanops.p, CHANOPS_1_CANCEL, TRUE);
    SetPanelPos (chanops.p, 100, 100);

    InstallCtrlCallback (chanops.p, CHANOPS_1_GO,
                         DoChannelAdditionCallback, 0);
    SetPanelAttribute (chanops.p, ATTR_TITLE, "Channel Addition");
    channellist_Copy (chanops.p, CHANOPS_1_CHANNELS);

    InstallPopup (chanops.p);
}
Exemple #13
0
void InitStatisticsCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int i;
    channelPtr chan;

    chanfunc.p = LoadPanel (0, "chanfncu.uir", STATISTICS);
    
    util_InitClose (chanfunc.p, STATISTICS_CLOSE, FALSE);
    SetPanelPos (chanfunc.p, 100, 100);

    channellist_Copy (chanfunc.p, STATISTICS_CHANNELS);

    chan = channellist_GetSelection();
    chanfunc_CalcStatistics (chan);
    SetInputMode (chanfunc.p, STATISTICS_SAVE,
            ((StringLength (chan->note) + StringLength(chanfunc.note)) < 255));

    InstallPopup (chanfunc.p);
}
Exemple #14
0
int  OperateReferenceCallback844(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
    int p;
    gpibioPtr dev = callbackData;
    if (event == EVENT_COMMIT) {
        p = LoadPanel (0, "sr844u.uir", SR844_REF);
        
        SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);

        util_InitClose (p, SR844_REF_CLOSE, FALSE);
		
        SetCtrlVal (p, SR844_REF_FREQ, sr844_GetDoubleVal(dev, "FREQ?"));
		sr844_CheckClear(dev);
        SetCtrlVal (p, SR844_REF_PHASE, sr844_GetDoubleVal(dev, "PHAS?"));

        SetCtrlAttribute (p, SR844_REF_FREQ, ATTR_CALLBACK_DATA, dev);
        SetCtrlAttribute (p, SR844_REF_PHASE, ATTR_CALLBACK_DATA, dev);
        InstallPopup (p);
    }
    return 0;
}
Exemple #15
0
void CVICALLBACK Help (int menuBar, int menuItem, void *callbackData,
		int panel)
{
	if ((outputHandle = LoadPanel (0, "Remotely.uir", OUTPUTVIEW)) < 0)
		 {
		 SetCtrlVal (panelHandle, PANEL_TEXTBOX,  "Load check uptime panel error,please try again!\r\n"); 
	 	 return;
		 }
	 SetPanelAttribute (outputHandle, ATTR_TITLE, "HelpInformation");
	 DimAction(1); 
	 if(WriteOupputBox(1))
	 {
	 	InstallPopup(outputHandle);
	 }
	 else
	 {
	  SetCtrlVal (panelHandle, PANEL_TEXTBOX, "Read data from help.txt error,please check it by manual!\r\n");
	 }
	 DimAction(0);
	
}
Exemple #16
0
int CVICALLBACK ViewOutput (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	
	switch (event)
	{
		case EVENT_COMMIT:
			if ((outputHandle = LoadPanel (0, "Remotely.uir", OUTPUTVIEW)) < 0)
				return -1;
			 DimAction(1); 
		//	 ResetTextBox (panelHandle, PANEL_TEXTBOX, "");  
			 if(WriteOupputBox(0))
			 {
			 	InstallPopup(outputHandle);
			 }
			 else
			 {
			  SetCtrlVal (panelHandle, PANEL_TEXTBOX, "Read data from output.txt error,please check it by manual!\r\n");
			 }
			 DimAction(0);
			break;
	}
	return 0;
}
Exemple #17
0
void K2400MeasureSetupCallback(int menubar, int menuItem, void *callbackData, int panel)
{
    int p;
    acqchanPtr measure = callbackData;

    p = LoadPanel (0, "k2400u.uir", K2400_MEAS);
    SetPanelPos (p, VAL_AUTO_CENTER, VAL_AUTO_CENTER);
    util_InitClose (p, K2400_MEAS_CLOSE, FALSE);

    SetCtrlVal (p, K2400_MEAS_LABEL, measure->channel->label);
    SetCtrlVal (p, K2400_MEAS_COEFF, measure->coeff);
    SetCtrlVal (p, K2400_MEAS_ACQ, measure->acquire);
    SetCtrlVal (p, K2400_MEAS_NOTE, measure->note);

    SetCtrlAttribute(p, K2400_MEAS_LABEL, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_COEFF, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_ACQ, ATTR_CALLBACK_DATA, measure);
    SetCtrlAttribute(p, K2400_MEAS_NOTE, ATTR_CALLBACK_DATA, measure);

    SetInputMode (p, K2400_MEAS_ACQ, !util_TakingData());

    devPanel_Add (p, measure, k2400_Meas_UpdateReadings);
    InstallPopup (p);
}
Exemple #18
0
int CVICALLBACK CheckUptime (int panel, int control, int event,
		void *callbackData, int eventData1, int eventData2)
{
	switch (event)
	{
		case EVENT_COMMIT:
			 char buffer[20000]; char pathName[MAX_PATHNAME_LEN];		char dirName[MAX_PATHNAME_LEN];   FILE    *hFile;	  char *p = ""; int i=0; int lenth=0; char temp[20]; //char value[50];
			 int flag =0;		 int row = 0; int column = 0; int insertcolumn = 0;  int confirmresult = 0;	 
	 
			 typedef struct
				{ 
					int x;
					int y; 
				} Point;

			 confirmresult = ConfirmPopup ("Check uptime","Do you want to check uptime now?");
		 
			 if ((outputHandle = LoadPanel (0, "Remotely.uir", OUTPUTVIEW)) < 0)
				 {
				 SetCtrlVal (panelHandle, PANEL_TEXTBOX,  "Load check uptime panel error,please try again!\r\n"); 
			 	 return -1;
				 }
			 SetPanelAttribute (outputHandle, ATTR_TITLE, "CheckUptimeRecord");
			 SetCtrlAttribute (outputHandle, OUTPUTVIEW_OUTPUTBOX, ATTR_VISIBLE, 0);
			 SetCtrlAttribute (outputHandle, OUTPUTVIEW_TABLE, ATTR_VISIBLE, 1);    
			 GetProjectDir (dirName); 
			 MakePathname (dirName, "uptime.csv", pathName);
			 WriteLog();
		   	 ResetTextBox (panelHandle, PANEL_TEXTBOX, ""); 
		 
			 if (hFile = fopen(pathName, "r"))
			{
		    	while (fgets(buffer, (int)sizeof(buffer), hFile))
		    	{
					row++;
					InsertTableRows (outputHandle, OUTPUTVIEW_TABLE, -1, 1, VAL_CELL_STRING);
			
					column = 0;
					p = buffer;
					flag = 0;
					do
					{
						column++;
						if (insertcolumn == 0)
						{
							InsertTableColumns (outputHandle, OUTPUTVIEW_TABLE, -1, 1, VAL_CELL_STRING);
						}
						lenth = FindPattern (p, 0, -1, ",", 0, 0);   // strip  ","
						if (lenth >=0)
						{
							memset(temp,0,20);
							for (i=0;i<lenth;i++)
							{
								temp[i] = *p;
								p++;
							}
							p++;
							SetTableCellVal (outputHandle, OUTPUTVIEW_TABLE, MakePoint(column, row), temp);
						}
						else
						{

							lenth = FindPattern (p, 0, -1, "\n", 0, 0);	  // strip  "\n"
							if (lenth >=0)								 // if find "\n"  write last string to last column
							{
							    memset(temp,0,20);
								for (i=0;i<lenth;i++)
								{
									temp[i] = *p;
									p++;
								}
								SetTableCellVal (outputHandle, OUTPUTVIEW_TABLE, MakePoint(column, row), temp);
								flag = -1;
								insertcolumn = 1;
							}
							else		// if not find "\n", write all to last column
							{
								SetTableCellVal (outputHandle, OUTPUTVIEW_TABLE, MakePoint(column, row), p);
								flag = -1;
								insertcolumn = 1;
							}
		
						}
				
					}while( flag != -1);
					SetTableColumnAttribute (outputHandle, OUTPUTVIEW_TABLE, -1, ATTR_COLUMN_WIDTH, 80);
					memset(buffer,0,20000);
												 
		    	}
		    	fclose(hFile);
			} 
			if (confirmresult)    // if user select yes to check uptime  install popup
			 {
				InstallPopup(outputHandle);
			 }
			else				 // if user select no, discard panel due to load it at beginning of this function
			{
				if (outputHandle)
				    {
		               DiscardPanel (outputHandle);
			        }
			}
			break;
	}
	return 0;
}