LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple event case issue

Hello all,

 

I have a situation with a VI that I'm working on. I hope someone can help me clarify my doubts or review my case. My VI consists of the following:

 

I have two rows and three columns of listboxes, each listbox displays different texts that are read from a text file:

Mocte117_0-1746742784671.png

 

In each listbox I have an option to add more options or remove some of the options:

Mocte117_2-1746742967378.png

 

I also have the function to delete a complete row

Mocte117_3-1746743107924.png

 

Each sample has a color depending on the file being read; in this case, I have three files. Each file contains different options, so if any data is read that corresponds to one of the three files, it is assigned a different color. This is the structure of the diagram:

Mocte117_7-1746743940806.png

 

I can also save all these modifications. Structure of the case event:

Mocte117_8-1746744025072.png

 

Everything works fine. My problem arises when I need to add a new function. This function adds three buttons to the screen, each of which opens a new file containing a different mix of options to be read:

 

Mocte117_5-1746743471867.png

 

Since these are buttons, I am trying to run a event case for reading each file but because the values ​​are read before the loop, I'm placing the event case outside the loop. Is this possible? Every time I run it, it only lets me open one file, but then the VI crashes when I click on another button:

 

Mocte117_6-1746743763753.png

 

Attached both VI.

 

Does anyone know how I can fix this? Thank you.

 

 

 

Download All
0 Kudos
Message 1 of 3
(274 Views)

You need to implement a proper state machine. An event structure on the top-level diagram can run exactly once per session. Since all your events lock the panel, any later triggering of any of the event will lock up the VI forever.

 

The concept of "dataflow" is central to any LabVIEW program, so make sure you fully understand it.

0 Kudos
Message 2 of 3
(257 Views)

To help you on your way: Place a single while loop, in the while loop, place a single case structure. On the default case, place a single Event structure. When a user event happens (a user clicks on a button for example), an event fires and it passes the state to the next iteration of the while loop, where the actual logic of that event happens (don't place any code in the event structure itself!).

 

Here is the most basic state machine as an example.

Forum.png

If you need a more complex logic, have a look at the JKI state machine for a more complete template.

0 Kudos
Message 3 of 3
(219 Views)