LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I force pages on a Tab Control to be viewed?

Ok, so I am trying to build a State Machine with a list of buttons that move between different states of the program. For instance, Save Data, Data Acquisition, Initial Measurements, etc. Now I am using a Tab Control to show all the different instrument controls/settings for the different State Machine Choices. One problem I am having is, if I press one of the State Machine Buttons, I then have to go and manually switch to the page on the Tab Control. Is there a way to programatically get the Tab Control to switch to the correlated page when I press a State Machine Button?

Thanks!
Andrew
0 Kudos
Message 1 of 7
(3,313 Views)
Yes you can. You can change the tab page by writting a number to the tab page property node "Value".
Good luck,
Greg
0 Kudos
Message 2 of 7
(3,313 Views)
When you say Tab Page Property Node "Value" do you mean the property node from the Tab Control or literally from the "Page"?

Also, and pardon my inexperience, but how do I exactly write the number to the node, because from what I can see the node outputs a number for "value"?
0 Kudos
Message 3 of 7
(3,313 Views)
In a program I've written I accomplish this by including a local variable in the state that needs a specific tab chosen (or an intermediate state if you don't want to be forced to look at that tab when you want to click on another one).

Simply create a local variable. Right click it and and choose "select item" to be your tab control. Right click it again and choose "change to write". Then wire in the value for the tab you want to view.

Hope this helps,
Neil
0 Kudos
Message 4 of 7
(3,313 Views)
Ok this works decently well.

One thing, I thought using Local Variables is generally not the way to go? There has to be a more elegant way of doing this.
0 Kudos
Message 5 of 7
(3,313 Views)
Yes instead of using local variables, use a property node. This is done by right clicking on the tab control icon on the block diagram. Change the property to "value". Right click on this again and change to write. Now simply wire a numeric constant or control to the property node. Write a 0 for page 1, a 1 for page 2 etc...
This way you are not creating local variables and using up resources.
Greg
Message 6 of 7
(3,313 Views)
A property node is NOT more elegant than using a local variable and can in some cases be worse. A local variable is fine for UI programming. It is bad when the programmer gets lazy and uses them instead of a wire to pass data to various places in the diagram.
0 Kudos
Message 7 of 7
(3,313 Views)