NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TS_StartModalDialog

In the TestStand help, I see TS_Err... information, but I don't see anything about TS_StartModalDialog and the other TS_ commands. Where do I find more information on these methods.
0 Kudos
Message 1 of 4
(3,024 Views)
I'm assuming you're using CVI. I believe the only help for these is available through the function panels. Use Ctrl+P and Ctrl+Shift+P to search for a function panel. Once you're looking at the function panel, you can right click each field to get help (in some cases, this may spawn a windows help viewer for the TestStand help). Apart from the function panel, you can look for possible comments in the source code (tsutil.c and tsutil.h).

--Peter
0 Kudos
Message 2 of 4
(3,019 Views)
In the documentation for TS_StartModalDialog , it says

Call this function immediately before calling InstallPopup to cause the dialog box to be modal with respect to the application that created the TestStand Engine object you specify. Do NOT use DisplayPanel with this function.

/*-------------------- Prototype ---------------------*/
int TS_StartModalDialog (CAObjHandle Engine_or_Context,
ERRORINFO *ErrorInfo,
TSModalData *TSModalData);


However, in TestExec.c, all use of InstallPopup is wrapped in a call to errChk. Why is this.

errChk( InstallPopup(splashPanel));
0 Kudos
Message 3 of 4
(3,017 Views)
errChk() and tsErrChk are not function calls, but rather compiler macros. The following are the definitions of the macros:

#define errChk(fCall) if (error = (fCall), error < 0) \
{ goto Error; } else

#define tsErrChk(fCall) \
if ((error = (fCall)) < 0) { \
TS_GetOLEErrorMsg(error, &errorInfo, errMsg, 0, 0, ERRMSG_SIZE);\
error = (error == DISP_E_EXCEPTION ? errorInfo.sCode : error);\
if(error < 0) goto Error;\
} else

Basically, this macro assumes you have the appropriate error variables defined for each function (error, errorInfo, and errMsg) and you have a label at the end of each of your functions with the error label (Error). For example

int myFunc(void)
{
int error = 0;
ERRORINFO errorInfo = {0, 0, "", "", "", 0, 0};
ErrMsg errMSg = ""
// some more declarations

// some code here

tsErrChk( TS_StartModalDialog(context, errorInfo, &TS_ModalData));
errChk( InstallPopup(panel));

// some more code here

Error:;
// cleanup and memory deallocation code here

return error;
}

Basically, this works because library functions follow the convention that a negative return value is an error condition. If the library call returns a negative value, the path of execution jumps down to the Error label.
0 Kudos
Message 4 of 4
(3,009 Views)