Example Code

Capture Events of the Front Panel Using Another VI in LabVIEW

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 detect event that occurs in another VI

 

Description

The Generate Events VI allows the user to mouse down or change the values of various controls.  The Capture Events VI captures the events generated by the Generate Events VI.  Pressing the stop button in the Generate Events VI will stop the execution of both VIs. Be sure to start the Generate Events VI before you start the Capture Events VI to avoid getting an invalid references error.

The Capture Events VI will dynamically register any mouse down or value change of the controls associated with the Generate Events VI and return the class name of the control, the Label of the control and the type of event.  The user must select the file path at which the Generate Events VI is located.  

 

Requirements

  • LabVIEW 2012 (or compatible)

 
Steps to Implement or Execute Code

1. Select Generate Events VI path
2. Run Generate Events VI
3. Run this VI
4. Use control in second VI

 

Additional Information or References

Generate Events VI Block Diagram

 Generate Events LV2012 NI verified.png

Capture Events VI Block Diagram

Capture Events LV2012 NI verified.png

 

Link

http://digital.ni.com/public.nsf/allkb/17ABD66EA8DAA0A986256FDA0067641E

 

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

Regards,

Sara Lewandroski
Applications Engineer | National Instruments

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

Comments
AmitKaria2k
Member
Member
on

Good one.. I liked the concept..

qasar
Member
Member
on

Is there a way to detect mouse clicks on a VI that is not running?


  
Yamoussa
Member
Member
on

It works perfectly, thanks so much !