LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

InstallPopup

In the tsErrChk call below, I'm wondering how I'm supposed to get the engine handle that the TS_StartModalDialog needs. Or, is there something else that will satisfy this method. Do I even need these calls before I call InstallPopup?

/* cvi doc says to call this immediately before call to InstallPopup */
tsErrChk(TS_StartModalDialog (gStartupWindow.engine, &errorInfo, &modalData));

/* Display the Startup Init PopUp Panel Again. */
InstallPopup (gStartupWindow.loading);
0 Kudos
Message 1 of 8
(4,234 Views)
Hi mrbean,

There are several ways you can get the engine handle.

One way is if you are calling the CVI code as a dll then you can pass in the engine handle from TestStand as a parameter.
You can also call the TestStand API before the TS_StartModalDialog to start a new engine. This can be found in TestStand API -> Advanced -> Engine -> New Engine in the Instruments folder of CVI. Hoever, if you create a new engine here, the popup will only be modal to the CVI code where the engine was created. This is because whatever engine handle is used will determine what the popup is modal in respect to.

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 2 of 8
(4,208 Views)
Could you please provide source code examples of how ...

1) you can pass in the engine handle from TestStand as a parameter.


2)You can call the TestStand API before the TS_StartModalDialog to start a new engine
0 Kudos
Message 3 of 8
(4,205 Views)
Hi mrbean,

To pass the handle in as a parameter you would need to have a CVI module that used that as a parameter. Then in TestStand, when you Specify the Module, you will be prompted to pass the engine into the module.

The function in CVI that uses the TestStand API to create a new engine is:
TS_NewEngine (const char *Server, CAObjHandle *Object_Handle)
The Help in CVI discusses each of the parameters in detail.

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 4 of 8
(4,182 Views)
Caroline,

I thought I needed tsErrChk and TS_StartModalDialog because I saw them in the TestExec.c source code. However, in my app, since I wsa having no luck, I simply do this...

gStartupWindow.loading = LoadPanelEx(0, UIR_FILE_NAME, LOADING, __CVIUserHInst);
gStartupWindow.status = LoadPanelEx(gStartupWindow.loading, UIR_FILE_NAME, TESTSTATUS, __CVIUserHInst);
gStartupWindow.nogpibcard = LoadPanelEx(gStartupWindow.loading, UIR_FILE_NAME, NOGPIBCARD, __CVIUserHInst);

InstallPopup(gStartupWindow.loading);

RemovePopup (0);

InstallPopup (gStartupWindow.nogpibcard);
RunUserInterface();
RemovePopup(0);

/* Display the Startup Init PopUp Panel Again. */
InstallPopup (gStartupWindow.loading);

DiscardPanel(gStartupWindow.loading);

/*
* Display initialization status user interface.
*/
DisplayPanel(gStartupWindow.status);
RunUserInterface();
DiscardPanel(gStartupWindow.status);

Questions

1) Do I need the engine for display type operations

2) I inherited this code and am not sure why for most of the panels, InstallPopup is used, then for the status panel, DisplayPanel is used. At that DisplayPanel call, I'm receiving a 'Library Function Error value == -4 panel, popup, or menu bar handle is invalid'


Thoughts?
0 Kudos
Message 5 of 8
(4,180 Views)
mrbean,

Regarding your CVI question, the source of the error is more likely this line of code:

gStartupWindow.status = LoadPanelEx(gStartupWindow.loading, UIR_FILE_NAME, TESTSTATUS, __CVIUserHInst);

The UIR_FILE_NAME line in particular is not clear. This appears to be a #define which should contain the path to your UIR file as a string. If this path is incorrect the LoadPanel, and then DisplayPanel will fail.

I would suggest double checking the path in what I assume is a #define, as it is not listed in the code you posted earlier.

Scott Y
NI
0 Kudos
Message 6 of 8
(4,151 Views)
Hi mrbean,

You only need the engine in specific display type operations. For example, if you are displaying a text box with a variable from teststand or were displaying the sequence as you do with the Operator Interface. If the display is not tied to TestStand, you do not need a reference to the engine. For example, if you are displaying a textbox with a variable that you created within the CVI module or if you are just displaying a popup message. These instances do not need to know anything about the TestStand environment calling the code.

As to the error you are receiving, I have forwarded this posts on to one of our CVI supporters who will be better equipped to help you with that question. He should be posting a response soon.

Thanks,
Caroline
National Instruments
Thanks,
Caroline Tipton
Data Management Product Manager
National Instruments
0 Kudos
Message 7 of 8
(4,149 Views)
Hi mrbean,

The problem thats causing the error is you have discarded the main panel and then trying to display a secondary panel which is a child to the one you have discarded.


/* Display the Startup Init PopUp Panel Again. */
InstallPopup (gStartupWindow.loading);

DiscardPanel(gStartupWindow.loading); <<>>
/*
* Display initialization status user interface.
*/
DisplayPanel(gStartupWindow.status);


Should this be a DisplayPanel instead.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 8 of 8
(4,146 Views)