Disable a Tab?

Is it possible to disable a single tab within a tabpanel?

I have some tabs defined, but they are not functioning yet, and I don’t want to confuse testers by allowing access to things they can’t test.
I was hoping to disable the tabs without having to remove them completely. Possible?

No, you cannot disable a tab with Xojo, although there may be declares or 3rd party plugins that can do it.

If the controls on the tab are on a ContainerControl (always a good practice), then you can just disable the container instead to disable all the controls on the tab.

Or you could use the Change event handler to and prevent the tab from being switched to.

Not the best solution but could you check which panel is selected in the change event and select a different panel instead. I.e. Remove the names off the inactive panels to make less confusing.

if tab panel=3 then select panel 2 - not real code btw.

This would have the effect of not allowing access to the panels.

We did something close to desable a tab in our toolkit on GitHub. It’s a bit outdated (we need to cleanup few thing before we continue to support it)

Note : it doesn’t work on Linux

We have something in MBS Plugins:

Ah, I need to update that for cocoa.
Until that use NSTabViewMBS class directly:


i know this is a very old discussion, but I am stuck on it. my tab panel is all tab and no panel: just 33 pixels tall. i want to disable the tabs themselves, not any controls on the panel because there are none. to see the issue, it is easy to make a little window, create a little container control, put a tab panel in it, then set the container to disabled. the tabs still respond. is this the expected behavior?

Sounds like you should be using a segmented control.

Disabled tabs aren’t really a user friendly thing. Here’s from the Apple HIG about iOS tab bars (I was looking for desktop information, but I think the idea still applies).

Even if you’re not trying to explain how to download songs, the tab should still be selectable with the interface indicating there is nothing to do. This allows an app to be explored and understood prior to actual usage, which helps ease learning curves and improves user experience.

Use a PagePanel and a set of buttons up top.

Each button can function in the place of tabs and can be enabled / disabled at will.

It would also make sense to have all the controls and tabs in place, and simply enable buttons for features AS they become usable - I know, a bit confusing, but you can communicate to testers what features are being implemented and need testing.

If you’re looking for tabs that can have icons, close buttons, be disabled, and face any direction you could take a look at our Tab Control https://www.bkeeney.com/allproducts/bks-tab-control/ We spent a lot of time making sure they looked good on HiDPI monitors too.