LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue of stopping two while loops when switching the tab control

Hello all,

 

I am implementing a function that using enqueue/dequeue for the button function selection in one tab, when the tap is switched to another, the two while loops stop immediately in the current tab and start the function of the new tab. (Sound crazy...) However, the program failed at recognizing the tab is switched and still stays in the current tab.

 

My simple code is attached, is it possible to implement such functions as described? Thanks for any comment if possible. Have a nice day!

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

Sorry forget to mention that this code was revised based on another guy from this forum...

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

@Andrea0909 wrote:

Sorry forget to mention that this code was revised based on another guy from this forum...


I'm sure I'm not the other guySmiley Very Happy

 

Lets get down with the two biggest problems I see

  1. When do you read "Read"?- yup- that there is a latching boolean outside the event that handles its value change event-  Just stick it in there OK? the code will be mostly fixed then
  2. Type Def that Tab! and replace all those BD constants with constants of type "MyTabContainer.ctl"  (Or you will be back after you try to change the order of tabs in the tab container if you have upgraded LabVIEW to the point where it doesn't crash when you attempt reordering tabs in a tab container)

I hate Tabs

 


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

Hi Andrea,

 

while I'm not hating tab controls I strongly advise to clean up your VI!

 

- Why are you using so many local variables? Their terminals are even unused!

- Why do you have a control AND an indicator having the very same label "Read"? How will you (or any other programmer) know which of them is referenced by the local variable "Read"???

- Why do you even have a loop inside the "page 2"/"page 3" case?

- After using so many local variables: WHY did you use "value" property nodes of the TAB control?

 

Sorry forget to mention that this code was revised based on another guy from this forum...

Why don't you provide a link to the source of this VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,627 Views)

Thanks for the reply.

 

The issue link is http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loops-inside-a-case-structure/td-p/591259, message 9. The function of this VI is to stop the while loop if switching the tab.

 

 My goal is turning on the "Read" LED when clicking the "Read" button in the first page of the tab. Then turning off the LED when switching to the second tab. The three looping led just to indicate the current tab the programming is staying at. 

 

As far for the issue, 

1. the loop1 led is always on when switching the tab.

2. the "Read" LED can not be turned off when switching to 2nd tab.

Guess the while loop in the 1st tab is not stopped when switches to others, while the original code in the above link is working. 

 

So what is going wrong here... Thanks for any comments.

 

 

 

 

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