Example Code

Populate Table Control by Clicking on Cell

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

Coding that exemplifies how to populate a cell from a table by just clicking on it.

Description

The Active Cell property node will not give you the XY coordinates of a cell that you click. The following example demonstrates how to determine the XY value of the active cell and then how to populate that cell with a string.

Hardware and Software Requirements

LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code

 

1. Use an event structure to detect a Mouse Down on the table control. You will also need to have an event for the stop button and an optional event for a timeout.

2. Use the Coords event data node to determine the coordinates of the mouse click.

3. Use the Point to Row Column invoke node to convert the mouse click coordinates to an XY cell position.

4. Unbundle the cell position and then use the Set Cell Value invoke node to write the combo box control to the cell. Note that the Row corresponds to the Y Index and the Column corresponds to the X Index.

5. On the front panel, right click on the table control and choose Advanced»Enabled State»Disabled. If you do not set this, the table control will not update.

6. When running the VI, choose a value in the combo box and then click on a cell in the table. That cell will be populated with the combo box string.

 

 

Additional Information or References

Capture.PNG

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

Contributors