Example Code

Dynamic LabVIEW Subpanel in a TestStand User Interface

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Description

Overview

 The visibility of LabVIEW code modules in a TestStand sequence is largely dictated by the "Show VI Front Panel When Called" option in the Step Settings pane. Even then, with this selection enabled, the called VI displays in its own window. This example shows how VI code module front panels can be embedded into the TestStand user interface.

Description

 

In LabVIEW, a subpanel control can be used to show the front panel of a VI within another VI. If a subpanel is included on the front panel of a user interface, we can populate it with the presently executing code module so long as it is indeed a LabVIEW VI.  This example illustrates how to display the front panel of a VI when the necessary conditions are met:

  • the step calls a VI code module
  • the step is configured to display the front panel of the module

2017-05-26_152425.png

 

The example uses the trace UI Message to notify the User interface before each step executes.  When notified, an event callback VI determines whether the next code module is a LabVIEW VI and if it has "Show VI Front Panel When Called" enabled.  if these conditions are met, the User Interface populates the subpanel with a reference to the code module VI. 

 

The callback also checks if the VI is loaded in the context of a LabVIEW project, and loads the soccesponding application reference, so thta the proper instance of the VI is displayed in the sub panel.

 

Caveats

Since this example uses the trace UI message, the enable tracing setting must be enabled in the station options for this example to function correctly.  If performance is a concern, ensure that the tracing speed is set to the fastest to minimize the performance impact.

The following scenarios will still result in the execution of the LabVIEW code module in its own window:

  • If the VI is already open in LabVIEW before the sequence is executed, the existing window will be used for the VI rather than the subpanel. 
  • When running the UI in the LabVIEW development system, the LabVIEW adapter must also use the development system.  If the UI is running as an executable, the LabVIEW adapter must be configured to execute VIs in the Runtime engine.
  • if the code module is called in a new thread, whether by existing in a subsequence call in a new thread or through the use of the Run VI Asynchronously step, the VI will execute in a separate window as well.
  • This example does not support the parallel or batch process models

Hardware and Software Requirements

 

Dynamic Subpanel - TS2019.zip

TestStand 2019 or compatible

LabVIEW 2020 (if using the ADE adapter configuration in TestStand).

 

Dynamic Subpanel - TS2016.zip

TestStand 2016 or compatible

LabVIEW 2016 (if using the ADE adapter configuration in TestStand).

Steps to Implement or Execute Code

  1. Execute the TestExec.exe file in the attached archive, or load the build script project, then open the top level VI.  
  2. Ensure that the adapter is configured correctly in the sequence editor by selecting Configure » Adapter, then selecting the LabVIEW adapter.  If you are running the UI in the development system, use the LabVIEW development system setting for the LabVIEW adapter.   If you are running the UI as an executable, use the LabVIEW runtime engine setting for the LabVIEW adapter.  
  3. open the Example.seq file in the user interface, and run it.  Observe that the LabVIEW modules are displayed in the subpanel.

 

Al B.
Staff Software Engineer - TestStand
CTA/CLD

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
robert.welcher@ni.com
Member
Member
on

Is there a way to get the source code for the guidll.dll so it can be recompiled for 64-bit applications?

mdwebster
Member
Member
on

In the 2014 version:

  • The control Subpanel Manager - states.ctl is missing and was in a TestExec.llb not found in the package (users\public\users\tester\downloads\oisubpanel).
  • The UIMessage Event Callback.vi is missing and seems to be located in a different TestExec.llb not found in the package (in TestStand 2013 simple oi directory)
  • Callback.vi is missing but unused, I assume it may be used in the event callback

Any chance of getting these issues fixed?  I'd like to see an example of making this work.

Rickyfn2
Member
Member
on

I was trying to run this example, but the same issues as above are occurring. Is there a corrected example anywhere?

JoseRivero
Member
Member
on

Hello, any ideas why the actual FP pops is a separate window all the time (and is just not shown in the subpanel?)

terickson
Member
Member
on

This example works when running from source code.  However, it DOES NOT work if running the EXE.  When running the EXE, the VI does not show up in the sub panel when it is supposed to. It is displayed in a pop up window.

 

How can this be fixed?

 

I tried LabVIEW 2019 with TestStand 2022 and with LabVIEW 2020 and TestStand 2022.

CLA
terickson
Member
Member
on

I would like to edit my previous comment, the example does work from an EXE if the LabVIEW Adapter is set to runtime.  It does state this in the description but I missed that.

 

However, any VI's in callback sequences will not automatically show up unless an expression is added to the callback sequence in the step before the VI call.

 

RunState.Thread.PostUIMessageEx(UIMsg_UserMessageBase +0, 0, "", Nothing, True)

 

The Callback VI must then be configured to handle UIMsg_UserMessageBase +0, which is basically a copy of what happens for message code 4.  (Or add UIMsg_UserMessageBase +0 to the case selection.)

CLA