09-13-2010 07:08 PM
I recently discovered the SubPanel front panel Control/Container and thought it was pretty neat. I have a great application I'd like to use it for, but I am having issues once I compile my code and try to make an executable.
The code runs perfectly fine as source code. I point the references to the sub-vi I'm calling and it loads it to the SubPanel in my main vi. I am then able to programmaticaly write to the controls, read from the indicators and use the front panel just as if I had opened the actual vi. Where it all falls apart is when I go to build my application to make an executable. I am able to compile the code, I add the sub-vi to the project "Source Files", make the main vi the "Start-up vi" and the called sub-vi I put in the "Always Included" section. This worked fine for a very simple and basic example I made where the main vi just called up the sub-vi and I only had a couple of controls without any sub-vi's in the called sub-vi. My code is quite big and involved and both (my main vi and the called sub-vi I'd like to embed in the SubPanel) have quite a few sub-vi's. The build doesn't give me any errors, I am able to launch the compiled code, but when it runs, I see a quick flash of a window "loading" vi's then that goes away and the SubPanel never gets populated with the sub-vi I had called. Any ideas???
09-13-2010 09:59 PM
09-15-2010 06:45 PM
Hey Ravens Fan,
Thanks for the post...I'll look into what you suggested a bit more and post if I find anything good, but I kind of doubt this is the issue. I am aware of the different "path stripping" modes/needs b/n source code vs. executables and this shouldn't be the issue in this case. I've actually hard wired the path to the sub-vi I'm calling in my main application. Ofcourse this works perfectly for source code. The funny thing is, I would not expect it to work if I built up my executable with that same path...but it does if the code is simple enough. I emailed NI with a simple application that demonstrated what I was trying to do and they told me I had to include the called sub-vi in my builder as a "Always Included" vi in the builder. I did this and it worked on my simple example code...when I went to try it on my actual very complicated application code...no go...
09-16-2010 06:36 PM
So played with it some more today...I don't think the calling path of the sub-vi is the problem, since I put an error indicator right after it's suppossed to open the reference to the sub-vi and there wasn't an issue. Never threw up any sort of error, but it also never populated the SubPanel, nor did it write/read to any of the sub-vi controls/indicators. I also rebuilt the application making sure to make one the Start-up VI and including EVERY sub-vi in either of the two main vi's I'm executing in the Always Included fields under Source Files in the Application Builder...too bad I can't get this to work, because it would be an awesome feature to use.
09-16-2010 08:27 PM
I don't have any real experience with subpanels, so I don't know if I can be of much help.
But if you can post your VI's. Perhaps just a scaled down version of your application that still shows the problem you are having, then perhaps someone can poke around and figure out what is going wrong.
09-17-2010 03:24 AM - edited 09-17-2010 03:25 AM
Maybe the front panel is removed from the VI during the build of the exeuctable?
Anyway I would advise you to call the Sub-VI with the following code:
Ton
09-17-2010 03:23 PM
Thanks. But that is how I am calling the sub-vi. I also added a property node to open the front panel when loading, still nothing...
09-18-2010 02:10 AM
Per default the front panel of a VI will be removed during the build into an executable. In your build settings you can state that the FP should be preserved.
Make sure this is done.
Another thing is to check the origing of the Front panel, it might be that the VI is loaded but that the visible area (inside the SubPanel) is only the default color.
Ton
09-20-2010 11:54 AM
Yeah, I've tried preserving the FP in the builder, I've tried setting the vi to always show the FP when called/loaded and I've even tried programmatically setting the property node to include/load the FP when called and nothing works. At best the sub vi comes up as a seperate window, but now even if it does that, the sub-vi is broken when I build it. But I still haven't been able to load it in the SubPanel container.
I've also thought about the Front Panel origin, but the SubPanel container should allow me to take care of it once loaded, because it loads up scroll bars if the sub-vi sub panel doesn't fit in the SubPanel Container you have created.
02-15-2011 05:42 PM
Hello All. I figured this out a few months ago, but was too busy with work to find time to post my solution. I just got done posting a tutorial to my issue here: http://decibel.ni.com/content/docs/DOC-15048
Hope this helps someone in the future.