LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event case double action

Solved!
Go to solution

Hello, I've made a VI that consists of two Tab pages. Each of page have three buttons...... ->thee measurement procedures

When starting the VI, always the Initialization is done. When swiching between pages, always the initialization is done.

 

Everything works fine except: when switching between pages, Initialization is done twice!!!! 

 

How to avoid that?

 

0 Kudos
Message 1 of 5
(2,449 Views)

And it should, with the way your code is set up. You should only have one event structure in this vi. The fact that you have the two in different cases doesn't isolate them. What is happening is when you change tab pages both event structures trigger, firing off the initialation code. You don't need the case structure, at least not for the events. Have only one event structure, it will handle all of the various buttons, regardless of which tab page they are on. They may be hidden from the operator (visually), but are not in the event structure layer. So, pull out the event structure from the case statement.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 5
(2,438 Views)

But what to do if I it is necessary to keep two pages with different measurement procedures? Depending on chosen page different Initialization procedures are used... and only afterwards thr Measurement procedures will work.

0 Kudos
Message 3 of 5
(2,420 Views)
Solution
Accepted by topic author ku_ku

Generally, tab controls are a visual aid for the front panel to group like controls.  The terminal is not connected to anything in code.

 

It sounds like you want a "state machine".  Search the forums and LabVIEW help.

 

Your code is basically inside out right now.  You should only have a single event structure and make that the outer most structure (just inside the outermost program while loop.)

 

Inside the appropriate event cases (one per event/action) use a case structure that determines what code to run based on your different measurement procedures.

Message 4 of 5
(2,414 Views)

Thank you for ideas... I've solved the issue with steady state machine

 

 

0 Kudos
Message 5 of 5
(2,394 Views)