LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LoadPanelEx parent

Hi,
 
I'm trying to load a CVI panel in TestStand as model dialog. I was using the code below and I could still access the TestStand window or even close TestStand and crash the software. Is there anything wrong in the code below?
 
hPanel = LoadPanelEx(0, "Panel.uir", panel1, __CVIUserHInst);
DisplayPanel(hPanel);
idPanel = RunUserInterface();
 
Should I pass a value as parentHandle (other than 0)? If so, how can I get the handle of the TS screen?
 
Thanks
Eric
0 Kudos
Message 1 of 10
(4,750 Views)
Rather than DisplayPanel, you should use InstallPopup in order to make it a modal dialog.
0 Kudos
Message 2 of 10
(4,748 Views)

I changed the code as follows, but it didn't make any difference. The panel was not modal.

hPanel = LoadPanelEx(0, "Panel.uir", panel1, __CVIUserHInst);
InstallPopup(hPanel);
idPanel = RunUserInterface();
 
Thanks
Eric
0 Kudos
Message 3 of 10
(4,741 Views)

Looks like I was too quick and simple with my answer - sorry about that.

I suspect that you are running into thread-related issues, beacuse (IIRC) a modal dialog box is only "modal" within the thread it is called. (This  NI page may be helpful)

I'm not at all familiar with Test Stand and how/if  threading may feature in your question.

Can any more knowledgeable people out there help?



Message Edited by Ian W on 12-17-2007 11:36 AM
0 Kudos
Message 4 of 10
(4,710 Views)
Hey Eric,

I'm assuming that you are wanting to make a dialog modal to TestStand.  If this is in fact the case, we have specific functions in TestStand to accomplish this: TS_StartModalDialog(Ex) and TS_EndModalDialog(AndDiscard).  These can be found in <TestStand>\API\CVI\tsutil.fp.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 5 of 10
(4,694 Views)
Hi,
 
I think you will find an example for modal dialogs in the Teststand\examples folders.
 
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 6 of 10
(4,686 Views)
Actually, we only provide modal dialog examples for LabVIEW and C++ MFC in the examples directory.  There are a couple of additional configurations that need to be specified in those environments (that the examples help with); you should just be able to use the above-mentioned functions though.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 7 of 10
(4,682 Views)

Hi,

Quick look at the examples provided on the website, most are TestStand 1.0.1. (suggest to NI that we needs some updated examples)

Here is related link

http://digital.ni.com/public.nsf/websearch/46B86421820CE1BA86256D8300565424?OpenDocument

Regards

Ray Farmer

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

Thanks for the responses from everyone. I think I should have clearified my question. I'd like to load a CVI panel from a DLL as an modal dialog with another application. For my systems, the application can be TestStand or a executable written in MSVC, Borland, ... .

I looked at the example Ian attached. It popped a modal help dialog by calling LoadPanel with the parent handle. If my parent application is TestStand or other applications written in MSVC. What the parentHandle parameter for LoadPanel should be?

Thanks

Eric

0 Kudos
Message 9 of 10
(4,657 Views)
Hey Eric,

You must use the functions that I mentioned to make the window modal to TestStand.  If you want the DLL capable of being used from multiple applications, you can add a parameter to specify whether TestStand is calling it or whether a different application is calling it.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 10 of 10
(4,621 Views)