How to Drag and Select Multiple Boolean Buttons in a 2D Array Simultaneously?

Updated Aug 9, 2025

Environment

Software

  • LabVIEW

This article outlines the steps in creating a VI that enables multi-selection functionality for a 2D array of Boolean buttons on the LabVIEW front panel. Users will be able to select a range of buttons by dragging and then set all selected values to either True or False at once.

To create a program that enables the selection of multiple Boolean by dragging the mouse, you will need to implement a logic in the block diagram.

Step 1. Set Up the Front Panel

  1. Create a 2D array of Boolean controls on the front panel. 
  2. Ensure the array is initialized with default values, either False or True. 

Step 2. Add an Event Structure

  1. Place an event structure inside a While loop.
  2. Add the following three key events:
    - Mouse Down
    - Mouse Up
    - Change All Selected Value 

Event Details

  1. Mouse Down
    - This event is triggered when you click on a Boolean control.
    - This event mainly captures the starting index of the selection, row and column.
    - The index is being stored in the shift registers.

     

  2. Mouse Up
    - This event is triggered when you release the mouse click.
    - This event captures the ending index of the selection and calculate the selected range.
    - The index is being stored in shift registers.

     

  3. Change All Selected Value
    - This event is triggered by a separate control on the front panel (e.g. a "Change All Selected Value" button).
    - Uses the stored start and end indices from the previous two events to define the selection range.
    - Uses the Initialize Array and Replace Array Subset functions to update all values in the selected range
         - If the first clicked value was True, set all to False.
         - If it was False, set all to True.


     Do take note that this sample logic only works when selecting from top-left to bottom-right.