LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add a page to tab control in run time?

Solved!
Go to solution

Hi,

I am trying to add pages to the tab control in run time mode, but I can't because it needs to be in Edit mode.

 

This is the steps I would like to do:

1. Run the application.

a. The application reads a txt file and translates it to an array with room numbers; [201, 202, 203, 204]

b. The application takes this array and sets up pages after how many that is in the array and the names should be the same as the numbers. (Now the program will start to collect information to fill the pages.

c. The user can now switch between the different pages. (Each page will have a table that will be updated with new information during run time)

 

Is this possible or do you have another solution?

 

Thankful for all the answers.

BR
Per
----
Always see the problem as a possibility to develop
---
0 Kudos
Message 1 of 4
(3,872 Views)
Solution
Accepted by EPN

No, you cannot add pages, just like it is not really supported to add controls or indicators either (well, unless you plan to always have LabVIEW installed, and not just the Run-Time Engine. If that is the case you can auto-generate tab pages etc. with VI Scripting).

 

You can use a picture control to "simulate" additional tabs, controls or indicators, but normally it is possible to find a different and easier solution.

 

In your case it seems that all the pages would have the same controls on them, it wuld just be the content that would change. So what you really want is a way to navigate between the available "rooms". You could add a listbox next to the tab control, fill that listbox with the available rooms, and use the value of the listbox to select which content to show on the single page tab next to it, or you could use a drop-down menu. If you do not like such alternative presentations of the room options then you could generate the tabs in a picture control, and have a single page tab control below this that showed the content of the tab that was selected in the picture control. This is a lot of work though.

 

Another option would be to create let's say 10 pages in edit mode, and then have arrows below the control that allowed the user to browse through the available rooms in groups of 10 (you still do not really need individual indicators on each page so you do not need to have them on the page...a trick to get that is to just move the indicators and controls over the tab control with the arrow keys, this will give you a black frame behind them, but in run-mode it will look as if they are on each page). This way you could have the tab-look and navigation without having to simulate the tabs with a picture control. The fact that many other GUIs have such a two-level navigation means that the user will still find it intuitive to use.

0 Kudos
Message 2 of 4
(3,867 Views)

Thank you.

I will go for the Listbox.Smiley Very Happy

BR

BR
Per
----
Always see the problem as a possibility to develop
---
0 Kudos
Message 3 of 4
(3,856 Views)

Hello,

 

Unfortunately it is not possible to make new tabs, neither change order of tabs.

 

I would recommend you not to use tabs, but Combo Box instead (under String & Path palette) - you gain a lot more flexibility and ability to manipulate data. In this case you will not have to make table for each tab, but only one and you programmatically choose data you want to present. How to change values of Combo Box more in following example:

https://decibel.ni.com/content/docs/DOC-6791

Main idea is to read all of the values of Combo Box is one array, then you manipulate those values as array, and then put them back to Combo Box.

 

But if want to use tabs and you know maximum number of tabs, there exists one workaround:

You can make maximum number of tabs in front panel, then at the start of program hide all of them. Then when you get array of room numbers you can change names of pre-defined tabs and show them. Beware that you change only name of tabs, but value of selected tab stays as pre-defined.

 

Here are two link that may help you to manipulate tabs - first link is an example of changing the names of tabs, and second one is example of hiding/showing tabs.

https://decibel.ni.com/content/docs/DOC-14285

https://decibel.ni.com/content/docs/DOC-9715

 

If you have any question regarding this issue, please fell free to ask.

 

Regards,

Gregor Černe

 

 

Message 4 of 4
(3,852 Views)