LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close tab button

Hello,

              I have a tab control and I want to have a close tab button on each tab. Exactly like the below figure. How do I do this? Since tab is not allowing me to customize with additional controls.

New Picture (9).jpg

“Talk is cheap. Show me the code.”
― Linus Torvalds
0 Kudos
Message 1 of 8
(3,372 Views)

There is no way of editing the actual tab control at run-time, so you can't actually close a tab. But you can hide it. This code hides the current tab:

 

Close Tab.png

Best regards,

Jarle Ekanger, MSc, PhD, CLD
Flow Design Bureau AS

- "The resistance of wires in LabVIEW is not dependent on their length."
0 Kudos
Message 2 of 8
(3,354 Views)

Well what I meant was on clicking the close button it should remove the tab. My original issue was with front end. I mean how can I have a button on the tab which would remove the tab?

“Talk is cheap. Show me the code.”
― Linus Torvalds
0 Kudos
Message 3 of 8
(3,349 Views)

@JarleEkanger: Could you also explain me step wise how did you achieve the code you have pasted. Since I am not able to get page property from tab control.

“Talk is cheap. Show me the code.”
― Linus Torvalds
0 Kudos
Message 4 of 8
(3,337 Views)

You can start with the attached code (or may be just extract the idea/concept and write your own code...)

 

Well there are couple of bugs... and I don't have time to fix it now...!!


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 5 of 8
(3,332 Views)

from left:

 

1 - this is a refnum constant that refers to the tab control.

2 - property node; once the refnum is wired in you should be able to find a "Pages" entry in the property list, just below the middle of the list. this property returns an array of refnum for each individual tab page.

3 - the "format into string" function from the strings pallette converts the tab control value to a string representing the name of the current tab.

4 - the for loop iterates through each of the page refnum in the array. when you wire the refnum to a property node, you get the "Page" property node, which has properties such as tab caption etc.

5 - it's the same thing in the case structure.

 

you find the "empty" property node on the block diagram pallette -> Application ... -> "Property Node"

Best regards,

Jarle Ekanger, MSc, PhD, CLD
Flow Design Bureau AS

- "The resistance of wires in LabVIEW is not dependent on their length."
Message 6 of 8
(3,330 Views)

@moderator1983: Well I knew that I can use a Boolean button on tab. But was hoping a different answer. :)....

I am sure everyone would like to have a close button on tab and I am also sure someone would have suggested this to the NI guys. I am just wondering why is it not implemented yet?

“Talk is cheap. Show me the code.”
― Linus Torvalds
0 Kudos
Message 7 of 8
(3,303 Views)

I can't test it right now, but doesn't the tab control support symbols?  If so you can capture a "Mouse Down" event on the tab control, and then use the coordinates to possibly detect if the symbol was clicked.  The event it self may even tell you if the mouse is over the symbol.

0 Kudos
Message 8 of 8
(3,277 Views)