Launching a Floating CVI User Interface in TestStand

Publish Date: Jun 12, 2018 | 3 Ratings | 5.00 out of 5 | Print | Submit your review

Overview

In many cases it may be desirable to have a floating user interface during a TestStand execution. This user interface may be used for user updates, or other custom interaction with the user more than what is available through the default TestStand Sequence Editor interface. This example program shows the recommended way to implement such a feature.

Introduction:

In this example we implement a progress bar to show the current progress as updated by an executing sequence file. When we begin our sequence, our floating user interface (UI) is launched in its own thread, calling a function from a DLL built in LabWindows/CVI. Throughout execution, our sequence occasionally sends a Custom UIMessage that contains a numeric indicating the completed percent of execution and a string indicating arbitrary extra information about the executing sequence.

This simple example's MainSequence Main Step Group simply loops through two steps 100 times. The first step of each iteration simulates the time it would take to execute actions in a testing sequence and increments a progress variable in its Post-Expression. The second step in the loop sends a UIMessage containing the up-to-date progress. The floating user interface handles the event fired by the UIMessage, updating its progress bar with the new percentage.


Numeric and String Data Showing Execution Progress

Note: Included in the attached download is the CVI C source project for the DLL. See the related links section for this example using application development environments other than LabWindows/CVI and programming languages other than C.

Important Concepts:

Support for Multiple Interfaces: Adding functionality to an Operator Interface is relatively straight-forward and involves little more than modifying the source code of a pre-existing TestStand Operator Interface to include the extra functionality desired. This works especially well when using UIMessages, since the same Sequence code can update multiple different Operator Interfaces. It is up to the individual Operator Interface how it responds to the UIMessages sent by an executing sequence, if it even does respond. This allows us to have different Operator Interfaces with different functionality and usability without having to change the sequence code at all.

    This method of abstraction works quite well with open-source Operator Interfaces. What about when we use the Sequence Editor? We cannot edit the source of this interface to include UI elements for our own customer functionality, so a floating user interface is a good way to work around this. This floating user interface should still follow the best practices for Operator Interface modifications, since it is still part of the Operator Interface layer. This example show how to implement a floating user interface in such a way that it responds to the same UIMessages that you would send to an open-source Operator Interface to update a progress bar. We check the ApplicationIsEditor property, and only launch the floating user interface if a Sequence Editor is the interface being used for execution.

Multi-Threading in TestStand: We launch the floating user interface in its own thread so that it can run without blocking the execution of our sequence.

User Messages: Custom UIMessages (User Messages) have an event number 10000 or greater. In this example we define message 10200 to be a progress update and 10201 to be the end of our sequence, signifying that our floating user interface to terminate and close.

Application Manager Reference Passing: Our user interface needs a reference to the Application Manager in order to register for and handle User Message Events. We use the GetInternalOption method to get the Sequence Editor's Application Manager reference.  See the Developer Zone Example: Test Stand: Effectively using the Sequence Context in LabVIEW for more information on passing TestStand references into external environments.

Related Links:

Example: Launching a Floating .NET Form in TestStand

Back to Top

Bookmark & Share


Downloads

Attachments:

floating_progress_interface.zi
p

Requirements


Ratings

Rate this document

Answered Your Question?
Yes No

Submit