Example Code

Creating a Boolean control with pictures

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

  • LabVIEW

Code and Documents

Attachment

Overview

This example shows how to create a Boolean picture control.

 

Description

Upon opening the Boolean with pictures.vi (or Boolean with Pictures 2012 NIVerified.vi ), the user will see the white button stating "light is off". When the program is run, this white button can be selected, and the image will change to say "light is on". Additionally, the Boolean indicator will toggle on. This white button was created and saved as a .png using Microsoft Paint.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

The picture was imported into the attached custom control with the following steps:

  1. Create a Boolean control in the top level program.
  2. Verify that the picture wanted is copied in the clipboard.
  3. Right click the control » Advanced » Customize... (This will open a new window).
  4. In this window, right-click the control » import picture from clipboard » choose the true, false, or decal (always visible) case
  5. Run the Boolean with pictures.vi (or Boolean with Pictures 2012 NIVerified.vi ) to test this boolen control with pictures.

 

Additional Information or References

Front Panel

1.PNG

 

When creating the control, you can also go to the top toolbar. Select Edit » Import Picture from Clipboard. This will put the picture on your VI; however, this does not tie the picture to a specific state of your control. The picture will be visible, but will not chance when the control changes state, shape, or size. It just remains as a visible item in the control that can be resized separately

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Lea D.
Applications Engineering
National Instruments

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