LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to programatically add tab pages on tab control

Hi All,

 

Is it possible to programatically add tab pages on tab control? If yes then how?

 

Thanks & Regards,

Shrinivas

0 Kudos
Message 1 of 9
(9,865 Views)

The easy answer is 'No', since it would not be possible to create objects on that page programmatically.

 

Have a look at this thread, which discusses the topic: http://forums.ni.com/t5/LabVIEW/Add-Tabs-Programatically/m-p/245418

 

Message 2 of 9
(9,860 Views)

Only if the owning VI is in edit mode.

Message 3 of 9
(9,827 Views)

If you're talking about runtime there is no way to add new controls to a vi, so even if you could add pages they wouldn't hold anything. Now you can simulate adding tabs by making pages visible and invisible.

 

I use a combination of sub panels and independant page labels and captions to simulate adding and removing pages.

Message 4 of 9
(9,808 Views)

What Matt suggested is probably the better alternative solution.  There might be others, but using subpanel in an existing Tab Control would be the way to go.

0 Kudos
Message 5 of 9
(9,746 Views)

Hi,

 

Could you please elaborate on this or provide some example so that I can proceed.

 

Thanks.

Shrinivas

0 Kudos
Message 6 of 9
(9,737 Views)

Doing this will require the use of VI server and methods and properties.  First, some questions:

 

  1. Is the number of pages you may need unbounded?
  2. Do you have a maximum number of pages you need to display at any one time?

 

If the answers are no and yes, then you can create a tab control with the maximum number of pages you need, and hide or show the pages, as necessary. To hide or show pages, use the Pages property to get references to all the pages.  Use Index Array to select the page you want to show/hide, then use its Page Visible property to show and hide it.

 

You can also get a lot more dynamic, if you number of pages you need to show at any one time is less than the total number of pages.  In this case, you will want dynamic page contents and tab name.  You can set the tab name by Page Label property of the page (right next to the Page Visible property).  You can make the content dynamic by using a subpanel as the only contents of the page.  You can find out about subpanels in the LabVIEW help or this post.

 

You also need to ask yourself whether a tab interface is the best one for your application.  I have usually found that if I need to show and hide a lot of tabs, I would be better off with a subpanel for my content and a text or menu ring the select the content.  Tree controls also work nicely for selection.

 

Good luck!  Let us know if you need more help.

Message 7 of 9
(9,716 Views)

 


@DFGray wrote:

 

 

You also need to ask yourself whether a tab interface is the best one for your application.  I have usually found that if I need to show and hide a lot of tabs, I would be better off with a subpanel for my content and a text or menu ring the select the content.  Tree controls also work nicely for selection.

 


If only one TAB would be displayed and you do not have a parallel process running on another tab, then why use TABs at all.  THe sub-panel will do just fine.

 

0 Kudos
Message 8 of 9
(9,703 Views)

Precisely what I was trying to say.  Even with a parallel process, if you are not displaying it at the moment, just host it in a subpanel when you do want to display it.  No need to kill the parallel VI just because it is not being displayed. Swapping things into and out of a subpanel can be fast and seemless, if you do it right.

Message 9 of 9
(9,698 Views)