示例#1
0
STD_ERROR	DLLEXPORT	GRAPH_CreateItem( char *szUIRfilename , int panel_const , int control_const , void **pItemData , unsigned int numberOfPoints , double StartX , double StopX , double MaxY , double MinY , char *szX_AxisName , char *szY_AxisName  , int bDisplayGraph , int *piGraphPanelHandle )
{
	STD_ERROR				StdError					=	{0};
	
	tsPlotGraphData			*pData				=	NULL;

	CALLOC_ERR( pData , 1 , sizeof(tsPlotGraphData));
	
	IF (( pItemData == NULL ) , "Item data can't be NULL");
	
	NO_CHK_STDERR(GRAPH_FreeItem( pItemData , 0 ));
	
	*pItemData = pData;
		
	pData->numberOfTraces = 0;
	pData->numberOfPoints = numberOfPoints;
		
	pData->start_x = StartX;
	pData->stop_x = StopX;
	pData->y_axis_max = MaxY;
	pData->y_axis_min = MinY;
	
	if (szUIRfilename != NULL)
	{
		if ( piGraphPanelHandle && ( *piGraphPanelHandle ))
		{
			pData->panel = *piGraphPanelHandle;
		}
		else
		{
			pData->panel = LoadPanelEx (0, szUIRfilename , panel_const , __CVIUserHInst ); 

			if ( piGraphPanelHandle )
				*piGraphPanelHandle = pData->panel;
		}

		if ( bDisplayGraph )
			DisplayPanel( pData->panel );
		
		pData->bExtUse = 0;
	}
	else
	{
		pData->panel = panel_const;
		pData->bExtUse = 1;
	}
	
	pData->control = control_const;
		
	if ( szX_AxisName )
		strcpy( pData->szX_AxisName , szX_AxisName );
	
	if ( szY_AxisName )
		strcpy( pData->szY_AxisName , szY_AxisName );
Error:	
	
	return StdError;
	
}
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;
}