LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Tabs Programatically

You can't programmatically create objects by any supported means, so this is a moot point to say the least. But if you could create objects, you could dynamically bind them to shared variables or datasocket items. That wouldn't require any code. Just a thought...
Jarrod S.
National Instruments
0 Kudos
Message 11 of 21
(2,913 Views)

Hi JITC and everyone else,

Guess what... it IS possible to add tab pages and controls while the program is running!!! This is really sweet... And how you may ask? Using .NET controls. Take a look at the program attached below which programmatically adds tab pages and adds controls to those tab pages. Ok, the example only does one of each, but you get the idea.

One small catch... (there had to be one): You will have to disable multithreading for your LabVIEW system for this to work. The reason is that LabVIEW by default spawns the tab pages and controls in a different thread than the user interface thread which hosts the tab control. The tab control can't be a parent object for child objects in another thread.

To disable multithreading, go to Tools >> Options and select Performance and Disk. Uncheck Run in Multiple Threads and restart LabVIEW.

Check it out!!!!!! This is LV 8. This requires .NET Containers which aren't available in 7.1 or before. Sorry!

Jarrod S.
National Instruments
Message 12 of 21
(2,895 Views)
A simpler, and cleaner, LabVIEW only solution, which has been hinted at/said several times, is to make a tab control with the maximum number of elements you could want, but make each of the dynamic elements contain only a subpanel.  You can then switch code in and out of the panels to your heart's content, provided you know the subVI interfaces.  As has been previously mentioned, you can show and hide tabs using the tab control properties.

That said, I must agree with Mike Porter that there is probably a better way to do what you want to do with the tab control.  Tab controls are great for getting GUI space and can be lifesavers when you need to show several different graph types in limited space, but menus and the various types of selection controls can get you to the same place.  Take a hard look at your GUI and decide if you really need this.  I have actually implemented a fairly complex scheme using unreleased (and buggy) features of LabVIEW to create a dynamic tab control.  It did not go out the door because it didn't make sense.  You would probably have the same experience.
Message 13 of 21
(2,882 Views)
do you mean running vis at the same time about multithreading?
0 Kudos
Message 14 of 21
(2,576 Views)
Hi Vahi,

This is an old discussion forum thread.
Can you be more clear about what you mean? Which specific reply you are referring to

Thank you
Van L
NI Applications Engineer
0 Kudos
Message 15 of 21
(2,547 Views)
Hi,
I know it is an old topic but this is what i want to do..
I want to create a tab control and add a new page to this by pressing a button or double-clicking the tab control..
However we have to disable multithreading. I will acquire data at the background. So there will be a running vi on the background. Does it mean multithreading?(I am using LV8.5)

Thanks,

Message 16 of 21
(2,527 Views)


vahi wrote:
I want to create a tab control and add a new page to this by pressing a button or double-clicking the tab control..

This was already answered in this thread, so why do you ask it again. Did you read all the replies. Is anything still not clear?


vahi wrote:
However we have to disable multithreading. I will acquire data at the background. So there will be a running vi on the background. Does it mean multithreading?(I am using LV8.5)

I don't think you have a correct understanding of the term "multithreading", because your question makes absolutely no sense.
 
What makes you think you need to disable it?


Message Edited by altenbach on 06-04-2008 09:00 PM
0 Kudos
Message 17 of 21
(2,522 Views)


altenbach wrote:


vahi wrote:
I want to create a tab control and add a new page to this by pressing a button or double-clicking the tab control..

This was already answered in this thread, so why do you ask it again. Did you read all the replies. Is anything still not clear?


vahi wrote:
However we have to disable multithreading. I will acquire data at the background. So there will be a running vi on the background. Does it mean multithreading?(I am using LV8.5)

I don't think you have a correct understanding of the term "multithreading", because your question makes absolutely no sense.
 
What makes you think you need to disable it?


Message Edited by altenbach on 06-04-2008 09:00 PM

Hi Altenbach,
 
Vahi is asking because of Jarrod's reply...


Jarrod S. wrote:

Hi JITC and everyone else,

Guess what... it IS possible to add tab pages and controls while the program is running!!! This is really sweet... And how you may ask? Using .NET controls. Take a look at the program attached below which programmatically adds tab pages and adds controls to those tab pages. Ok, the example only does one of each, but you get the idea.

One small catch... (there had to be one): You will have to disable multithreading for your LabVIEW system for this to work. The reason is that LabVIEW by default spawns the tab pages and controls in a different thread than the user interface thread which hosts the tab control. The tab control can't be a parent object for child objects in another thread.

To disable multithreading, go to Tools >> Options and select Performance and Disk. Uncheck Run in Multiple Threads and restart LabVIEW.

Check it out!!!!!! This is LV 8. This requires .NET Containers which aren't available in 7.1 or before. Sorry!



Even I m also checking where the thing called Performance and Disk exists in the Tools >> Options menu in LV 8.5.1. Smiley Happy
 
I m not able to locate it.
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 18 of 21
(2,510 Views)
That option probably doesn't even exist anymore in LabVIEW. Granted, sometimes I do get more carried away with trying anything to solve a problem when the correct thing to do is to ask if the problem makes sense! My old post should really not be seen as a good way to solve this problem.

The best way to effectively accomplish this is what DFGray said about creating too many tabs in advance and hiding them. Then programmatically show them one at a time to create them. Hope this helps!
Jarrod S.
National Instruments
0 Kudos
Message 19 of 21
(2,506 Views)
Thanks  Partha,
Thanks for you Jason...
But i need unlimited pages or another structure....
Thanks all anyway...
0 Kudos
Message 20 of 21
(2,471 Views)