Solution
Yes, a subVI can open its front panel on a remote machine if the following conditions are met:
- The remote machine has control of the front panel. (You can also link to the subVI front panel for manual access from the main remote front panel.)
- The subVI is set to "Show front panel when called". This setting can be changed by right-clicking on the subVI on the block diagram and clicking SubVI Node Setup or in the Window Appearance tab in VI properties.
- The subVI is not set to be re-entrant. This can be set in the Execution tab of VI Properties.
More information on options for setting up subVIs with your front panel can be found in the sections below:
Using SubpanelsCalling remote front panels via a web browser uses the LabVIEW Run-Time Engine, which is able to open the subVI's front panel. However, the subVI's front panel will open as a separate window from the remote front panel. This means that it will look like a normal LabVIEW VI front panel and will not be embedded in a browser window.
If you want to have the window embedded in the main VI, you can use a Subpanel control as described in
Loading a Front Panel in a Subpanel Control.
Connecting to a SubVI in an Executable
By default, when you build an executable, the application builder detects when a VI in the build is not displaying its front panel and removes it from the executable. When you create an HTML file for the VI through the Web Publishing Tool, you are creating a link to the VIs front panel. If you then connect to that HTML file from a web browser, your HTML file will be referencing a VI that no longer has a front panel. This can cause the following error:
Resource not found.
An error occurred loading VI 'lvtmp0.vi'.
LabVIEW load error code 3: Could not load front panel.To resolve this issue In LabVIEW 8.0 and later, add your subVIs to the Dynamic and Support VIs list in the Source Files page for your Application Build. By default they should already have Remove Panel unchecked in the Source File Settings page.
To resolve this in LabVIEW 7.1 and earlier, you need to make a slight modification to your build settings during the application builder process.
- After adding your VI as the top-level VI for the build, switch to the VI Settings tab.
- Find a subVI whose front panel you want to publish in the list (they are in alphabetical order). Notice that the Remove Panel option has been set to Yes for the executable. Click on the VI in the list to highlight it, and select Edit Build Settings.
- Change the Remove Panel pull-down option to No, and click the Change button.
Repeat this process for all subVIs whose front panels you want to publish. When finished, continue with the build process as normal, and you should now be able to view the front panel of these VIs through remote panels.
You can find more information on using remote front panels with LabVIEW Executables in
How Can I Use Remote Front Panels With LabVIEW Executables?HTML Links to SubVI Front PanelTo view the front panels of subVIs from a remote computer other than the controller, you can use HTML links embedded in the main VI's front panel. The process for this is described below:
- For each subVI that you want to publish to the web, select Tools » Web Publishing Tool...
- Modify the Document Title, Header, Footer, and Viewing Options as you see fit.
- Save all the
*.htm
files in the same folder from which you will publish your top-level VI. For the purposes of this KnowledgeBase, each file will be saved as SubVI01.htm
, SubVI02.htm
, SubVI03.htm
, etc.
- Open the Web Publishing Tool for your top-level VI and modify the title, header, and viewing options as you like.
- In the Footer section, add the following: <a target="new window" href="SubVI01.htm">SubVI Title</a> , where
SubVI01.htm
is the name of your subVI *.htm
file. SubVI Title is the name that you would like to be displayed as the link. Using target="new window" allows the SubVI to be opened in a new window. - Repeat the text in the step five, separating each line with , for each subVI front panel you want to access through your web browser. For example,
<a target="new window" href="SubVI01.htm">SubVI Title</a>
<a target="new window" href="SubVI02.htm">SubVI Title</a>
<a target="new window" href="SubVI03.htm">SubVI Title</a> - Press the Start Web Server button if it is not already greyed-out.
- Press the Save to Disk button and save your top-level VI's
*.htm
file in the same folder as your subVI's *.htm
files. - The Web Publishing Tool will prompt you with the URL for your new web page. Press the Connect button and your web page should launch.
Following the above steps will produce a Remote Front Panel for your top-level VI with links to all the subVI front panels at the bottom. Alternatively, you may place the HTML links in the header section of the Web Publishing Tool. Refer to the Related Links below or the LabVIEW help file for more information regarding the Web Publishing Tool.