From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI Input Buttons Not Activating Event Structure

Solved!
Go to solution

Hey Everyone,

 

I'm having anissue with a subVI which takes a user file, plays with the file path data type until it is in the form of a string and then puts it into a string array in a list box. The issue I'm having is that I've created input and output terminals to the buttons seen in the image, but the event case structures they control aren't executing when I press the buttons that are wired to the terminals of the sub VI (the buttons up one level from the image below).  They DO work when I use the subVI front pannel rather than the front pannel of the VI that's the next level up.

 

So far I've tried:

-Moving the buttons into the while loop

-Moving the buttons into the event structure

-Changing the event case handling to execute on a mouse click of the button vs. a value change

 

Thanks in advance for any help anyone is able to give me! 

Download All
0 Kudos
Message 1 of 6
(3,085 Views)
Solution
Accepted by topic author RASGary

Yeah, writing a value to a terminal never causes a value change event.  Think of it as a "User Changed Value" event.  To programatically fire a value change event you must write to the Value(Signaling) property of the control or indicator.  

 

Latching booleans do belong in the event case that handles the VC event.

 

You could read the terminal (use a local varible) before the while loop compare it to the last value (use a feedback node) and use a case structure to determine if you want the VC event to fire based on the value passed in from the caller.


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

after what Jeff said , do not use two event structure into a single vi or worse in one while loop.

register every action with one event structure only

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

Thanks for the replies! How would I read the value from the terminal if the button's value can only be altered by user input? Do I have to take the input as a string or integer type and convert it to a boolean? Also, what's the harm in using multiple event structures in a while loop? Does it prohibit Labview from making use of multi threading? Thanks again for all the help! 

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

@RASGary wrote:

Also, what's the harm in using multiple event structures in a while loop?


For one, a loop can't iterate until everything inside has completed.  So, in your code, you would have to add an item AND clear the list in order to iterate the loop.  I really don't think you want that.

 

You might want to look into an Action Engine.  The idea I'm thinking here is that you change your subVI so that it doesn't use the event structure.  Instead, it uses a case structure to react based on whatever action you want.  You can then use that code in the main VI.

 

Or the simple solution is to just make the subVI's front panel visible when it is called.  This would eliminate the need of the GUI on the front panel, though.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(3,047 Views)

Thanks again for the help, I'll try a few of these methods and make sure I accept a whichever one works best as the solution when I figure it out! 

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