LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tab control

I put a tab control on a blank front panel. Then on the block diagram I wired the tab control to a numerial indicator. When I run this vi, everytime I change the tab, the indicator shows the number of the tab. However, on an old vi with a tab, the indicator only chnages when I start the vi, not when I chane the tab. Why? What do I do?
Thanks
Doug
0 Kudos
Message 1 of 8
(3,679 Views)
I put a tab control on a blank front panel. Then on the block diagram I wired the tab control to a numerial indicator. When I run this vi, everytime I change the tab, the indicator shows the number of the tab.
 
This may be happening if you are running the VI continously or if the tab is in a loop or you are running the VI everytime after changing the tab.
 
However, on an old vi with a tab, the indicator only chnages when I start the vi, not when I chane the tab. Why? What do I do?
That's how it should work actually. If u want the indicator to change in real time it needs to be in a loop or something so that it keeps polling continuously. 
0 Kudos
Message 2 of 8
(3,660 Views)
Show us your code. 🙂
 
You could run your VI in execution highlighting to see when, and under which conditions, the indicator receives new data.
0 Kudos
Message 3 of 8
(3,643 Views)
I eliminated all my code and was able to get the page indicator updated when running continuously. I guess that means that I have some loop running that somehow keeps me from getting back to it. It seems a little strange because I can run other parts of the code. Here is the code minus some sub vi's if care to look at it.

Thanks
0 Kudos
Message 4 of 8
(3,619 Views)

Put the tab terminal and PAGE terminal in a loop, say 'OBJECT DATA' and PAGE will be updated. The extra local variable by the way has no purpose.

Also, try just to put the tab control in that loop and use right-click on the right-side of the tab icon, select 'create indicator'. This will set the right type for the 'Page'.indicator.

Bart Boshuizen,
www.morechemistry.com
0 Kudos
Message 5 of 8
(3,612 Views)
Well the short answer to your question is that you only read the value of the tab control once where it is wired to the PAGE indicator. This indicator won't update unless you set it to something. This was mentioned already, if you want to continuously see that number update, put it in a loop so the tab control is polled. Even better would be to use an event structure and update it only when the value of the tab control changes.
0 Kudos
Message 6 of 8
(3,609 Views)
You seem to have a conceptual problem with dataflow. Don't worry, after playing with LabVIEW for a while, things will become very easy and clear very soon. 🙂
 
Others have pointed out already the core problem. Don't forget that you can set your VI to "execution highlighing" mode: Press the diagram toolbar button with the lightbulb to on and now ruin the VI while watching the diagram. Now you see how the data flows in slow motion and you can see where things go wrong.
 
You seem to be familiar with text based programs and are trying to duplicate the functionality of "variables" using local variables. This is normally not needed. A local variable is just a secondary access to a front panel element, so if you do the following...
 
 
...you are writing the same wire value to the indicator directly and then again to a local variable representation of the same indicator. Basically, you do the same thing twice. You can delete that local variable and it will not change one thing! 🙂
In addition, the indicator should probably be an integer (blue) an not floating point (orange), so change the representation by right-clicking. There is no tab =1.5, for example. 😄
 
 
You seem to be creating that indicator for the sole purpose of checking its value against a constant. So, instead of relaying through a local variable, place the tab terminal where it is needed. Now right-click the tab terminal and "create constant. Select the right tab and compare that, directly where it is used.
 
 
Two of your loops will spin only once, so you might as well delete these loops. The termination terminal is "continue if true", but you use latch action booleans. These are typically OFF, you your loop will spin only once. These same loops also don't have a small wait statement (e.g. 100ms). If they would ever spin, they will consume all CPU, recalcualting the same old data over and over again.
 
Again about locals. Controls and indicators have their own data copies and will retain them forever unless new values are received. The following makes thus no sense. You are reading the data of an indicator via a local variable, then immediately write the same data back to where it came from. Pretty useless. 😉
 
 
Overall, the code is still too chopped up to make any sense. Let us know if you have a more final version so we can help eliminate some typical beginners mistakes. 🙂 Good luck!

Message Edited by altenbach on 09-06-2007 08:48 AM

Download All
Message 7 of 8
(3,594 Views)
That's why I said mine was the short answer. Thanks for posting the long answer, altenbach.
0 Kudos
Message 8 of 8
(3,587 Views)