LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Tabs Programatically

I wish to add tabs programatically in my program. I want the user to be able to add another tab while the program is running. I also wish to allow the user to delete tabs while the program is running. How do I do this? Thanks for the help.
0 Kudos
Message 1 of 21
(6,819 Views)
I don't think you can add or delete pages in a tab control when the vi is running. Even if you could add them, there wouldn't be any objects on the page. You can hide the set of tabs while a vi is running. Can you post an example of what you want to do??
0 Kudos
Message 2 of 21
(6,812 Views)

You can show or hide individual tab pages, disable them, etc.

Attached is a simple demo to show/hide a page via a boolean control (LabVIEW 7.1).

Message Edited by altenbach on 07-23-2005 09:40 AM

Message 3 of 21
(6,812 Views)

As the others have pointed out you can't add tabs while a program is running. If you think about it, how many programs have you seen that have an interface where users can add tabs. In fact I would say that the number of tab control in all applications is dropping because they take up a ton of room on a screen and IMHO get dificult to manage after more than 1 row. What is it that you are trying to accomplish interface-wise? There are many other control structures that are "exandable" (tree controls, pop-up menus, menu-bar menus, list boxes, etc.) you just have to find the one that makes sense for your interface.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 21
(6,796 Views)
It is too bad to know adding(newly) tabs in LabVIEW can not be handled when runtime.
I was expecting something like if OO style,
/*
tabControl.addNewTab("Tab Name", new anObject);
*/
The anObject can be a graph or any ojbect to display on GUI.

If still there is another way to achieve this with LV, it will be so great.

Thanks
0 Kudos
Message 5 of 21
(6,673 Views)

So, what would be the use?

Even if you could add a new tab and a new graph or control on it at runtime, it would not be connected to any code... pretty useless.

Can you explain why you think you need this. Any practical example?

Don't you think that the method in my example above is entirely sufficient? 

Message 6 of 21
(6,670 Views)


@altenbach wrote:

So, what would be the use?



There is one answer: dynamic GUI generation.
Ok - unless the code can't be created dynamically, it is useless.
 
I once made a GUI (using JAVA) where I dynamically created a toolbar to access various internal frames. Ok, it would have been possible to create a fix toolbar with a fixed number of buttons, but it's not flexible.
 
Although I like LV I have to admit that I sometimes think it's unflexible. I recently read a post about mouse events on a table. They were fired if a cell was clicked but also when the scrollbar was clicked. In other languages this is separated and much more flexible.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 7 of 21
(6,660 Views)

Dynamic GUI object creation?

ANYTHING can be done using the picture control.

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14&jump=true

NOTE:

"ANYTHING" will take more time to develop than hiding and show pages.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 8 of 21
(6,650 Views)

Lesson to learn:

Dynamic GUI object creation (1) != Dynamic GUI object creation (2)

1: Create a defined object dynamically due to specific conditions

2: Create a "freestyle" front panel object programatically

Definitely two possible topics... 😉

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 9 of 21
(6,647 Views)

I came up with a "solution" to being able to dynamically creating objects in LabVIEW (note the quotation marks). It's a clever use of subpanels. My approach - and I don't really recommend this, but's it's interesting at least - was to create a linked object list. A linked list in general is a data structure that contains the element itself and a link to the next element. My idea was to twist this around to being a control or indicator and a subpanel to host the next object (which has a control or indicator and a subpanel, etc.). This allows dynamic generation of any number of objects in any combination that can all send or receive data to a root-level host VI. The root VI is also in charge of dynamically creating or destroying objects. In my case I used an XControl to control everything. I posted the example online at the community forums here. Take a look!

A couple things to note: this won't allow you to create multiple tabs directly, but you might cleverly be able to create things that look like tabs and use subpanels for the tab "pages" (I don't think this post can take any more quotes 🙂 ). Second, my approach is 1D, where the controls expand to the right, but this could be expanded to include a full 2D topology.

And sorry folks, due to the XControl-ness of it all, this is LV 8 only. Honestly, Ben's picture control approach might be much easier than this. Enjoy!

(Also note if you download the example to run it with the included project file open)

Message Edited by Jarrod S. on 07-27-2006 09:43 AM

Jarrod S.
National Instruments
0 Kudos
Message 10 of 21
(6,626 Views)