I’ve now implemented showing and hiding individual tabs for both Desktop and Web. It will be available in the next release.
The API uses two TabVisible overloads:
TabVisible(index) returns whether a tab is visible.
TabVisible(index, visible) shows or hides it.
For example, put this in the window or page’s Opening handler to start with the third tab hidden. Tab indices are zero-based:
TabPanel1.TabVisible(2, False)
Then, in the handler for the option that makes that tab relevant, you can reveal it:
TabPanel1.TabVisible(2, True)
This should cover the workflow Adam described, where changing an option makes additional tabs appear or disappear.
Hiding a tab preserves its controls and their current state. If someone enters text, changes a value, or scrolls within a tab, that work remains when the tab is shown again. Showing it does not rerun constructors or Opening.
A few details about selection:
- Hiding a tab leaves every other tab’s index unchanged.
TabCount still includes hidden tabs.
- Hiding the selected tab selects the next visible tab to its right, falling back to the nearest visible tab on its left.
- If every tab is hidden,
SelectedTabIndex becomes -1. Revealing a tab then selects it. Otherwise, revealing a tab preserves the current selection.
Hidden tabs are skipped during keyboard navigation, and focus moves out of content that becomes hidden.
Studio continues to show every authored tab so you can edit its contents normally. Visibility is controlled at runtime through code, including from Opening.
I’ve also added TabID(index) and TabIndexFromID(id) for identifying a particular tab independently of its current index. Those IDs belong to the running panel instance and should not be saved between runs.
This completes the visibility part of the requests above. I’ll continue working through the other TabPanel improvements in stages.