LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find out which control triggered the event?

Solved!
Go to solution

In my program, there are six buttons that does similar things, like changing the value of an array depending on which button is clicked. I used an event structure to do this. However, instead of repeating my codes six times in six events (one for each button click), I'd like to program one event case that responds to any of the six buttons. The question is, how do I know which button is clicked inside the case (any of the button can be either false or true, so reading the button value won't help)?

0 Kudos
Message 1 of 6
(3,239 Views)
Solution
Accepted by topic author pellet8

Configure the event property node to return the ref of the object that triggered the event. The ref can be used to check if it the smae control using a variety of methods (name, equal to a ref etc).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 6
(3,237 Views)

this snippet demonstrates what Ben explained  it will cause the chosen stop button to blink before exiting

Which.png

 

Oh when will the snipet tool get fixed?Smiley Frustrated


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 6
(3,222 Views)

Jeff Bohrer wrote:

Oh when will the snipet tool get fixed?Smiley Frustrated



Jeff, are you using Ton Plomp's Code Capture tool? It is awesome for a lot of reasons. The nicest part is that when you do a capture it saves the snippet to a temporary file and places the path to the temp file in the clipboard. You can create a VI, capture a selection, then in the browse for image control on the forum you just paste the file name from the clipboard. No need to go through the hassle of saving the snippet first then browsing for it. And it works with references.

 

Example_VI_BD.png

 

 

=====================
LabVIEW 2012


0 Kudos
Message 4 of 6
(3,214 Views)

@Steve Chandler wrote:

Jeff Bohrer wrote:

Oh when will the snipet tool get fixed?Smiley Frustrated



Jeff, are you using Ton Plomp's Code Capture tool? It is awesome for a lot of reasons. The nicest part is that when you do a capture it saves the snippet to a temporary file and places the path to the temp file in the clipboard. You can create a VI, capture a selection, then in the browse for image control on the forum you just paste the file name from the clipboard. No need to go through the hassle of saving the snippet first then browsing for it.



Unfortunatly I'm behind a curtain here that discourages third party tools. I know of the third party stuff but it might as well not exist unless it comes on the installation DVD.  Thanks for the response though some other member may find the link useful

 

I can't even load Firefox on this machine and am stuck with IESmiley Sad


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 6
(3,206 Views)

Wow that is strict. It is also understandable - it's a dangerous world. Please don't tell me that you cannot use VIPM! (Very useful for internal package creation/managment although it probably makes it too easy to install third party packages behind the curtain.)

=====================
LabVIEW 2012


0 Kudos
Message 6 of 6
(3,187 Views)