Hide a TabPanel tab at runtime

Hello!

Just wondering if it’s possible to set a TabPanel tab as hidden with code.

Does anyone have a hint?

Thanks !

No
Add or remove are the only options

Or move out of the window area.

Not in my case, i do not need to hide the entire TabPanel but just one Tab of it.
Anyway think we should be able to do that, maybe i’ll fill a request for it.

[quote=178646:@Matteo Lovatti]Not in my case, i do not need to hide the entire TabPanel but just one Tab of it.
Anyway think we should be able to do that, maybe i’ll fill a request for it.[/quote]

Oh. I understand. You want a tab to disappear and reappear ?

The best I found was to place the controls onto a ContainerControl so you can remove the tab instead of hiding it, then to have it come back, insert it, and embedwithin the ContainerControl.

Good idea ! But i ended up with a popupmenu that toggles visibility between a couple of container controls.
It fills my needs better and was simpler to implement.

<https://xojo.com/issue/10520>

[quote=179079:@Matteo Lovatti]Good idea ! But i ended up with a popupmenu that toggles visibility between a couple of container controls.
It fills my needs better and was simpler to implement.[/quote]

A PopupMenu is not at all the same thing as tab navigation. It would not be too difficult to create tabs in a canvas, and to couple that with a PagePanel.

Wow 2009 !

In all honesty i think i never used a PagePanel in my life, i’ll take a look at that, thanks !

Its unlikely that this will ever happen since the underlying toolkits literally don’t support it
At best we’d have to have some code in between your code & the actual UI tab control that could save a tab / page
A great opportunity for bugs

Did you try Alex Restrepo Custom Tab Panel ?

I’ll take a look at that, thanks !

I’ve used this in projects before.
It does take some updating & tweaking to make it look native IF thats the look you want.
You may need to tweak it depending on what version of the OS your running on.

Or just do something totally NOT platform UI and live with a totally custom look.

with recent MBS Plugin on Mac:

dim n as NSTabViewMBS = TabPanel1.NSTabViewMBS dim t as NSTabViewItemMBS = n.tabViewItemAtIndex(1) t.Enabled = false
That disables the tab.

in order to sort of disable one of the tab, i simply put some code on the on change of the tab panel to set the value for the tab panel to the previous tab…

say u r on tab2 and you want to click on tab4 but tab4 is disable, so all i did is set tabpanel1.value=1

Here is something the works fairly well :

  • Create a TabPanel with all the eventually needed tabs
  • Make it part of a control set
  • Put the controls to go into it onto container controls
  • To fill the Tabpanel, select a tab and embedwithin the appropriate ContainerControl, then go for next tab and do the same

When you need to remove a tab, add a member and make the original invisible, like so :

dim x as new tabpanel1 TabPanel1(0).visible = false x.remove(1)

Then add the appropriate container controls as before.

Whenever you want the full rack again, close the crippled one and make the original visible.

That way you can create any kind of combinations you like at any moment. Since you are never going to display more than one member, you probably won’t need to be concerned about managing the index in the control set events.

But what about Win & Linux?

@Markus Winter I have no idea if Microsoft or the Linux guys support disabling tabs.

My setup for this is:

ContainerControl // I draw the rounded rectangle in the ContainerControls paint event SegmentedControl PagePanel