While rethinking about it last night, it may not be that slow if on user interaction you just flush the main group and re-attach already existing dialog.
So you need to modify your `def _DrawQuickTabGroup(self)`` method like so to only display visible dialog:
def _DrawQuickTabGroup(self, onlyVisible=True):
""" Creates and draws all the SubDialog for each tab,
take care it does not hide these according to a selection state.
Returns:
True if success otherwise False.
"""
# Checks if the quicktab is defined
if self._quickTab is None:
return False
activeIds, activeNames = self.GetActiveTabs()
# Flush the content of the group that holds all ours SubDialogs
self.LayoutFlushGroup(ID_MAINGROUP)
#self.GroupBorderSpace(left=5, top=5, right=5, bottom=5)
# Iterates over the number of tab to create and attach the correct SubDialog
for tabId, (tabName, tabGui) in enumerate(self._tabList.items()):
toDisplay = tabId in activeIds
if not toDisplay:
continue
self.AddSubDialog(ID_QUICKTAB_BASE_GROUP + tabId, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0)
self.AttachSubDialog(tabGui, ID_QUICKTAB_BASE_GROUP + tabId)
self.LayoutChanged(ID_MAINGROUP)
return True
Then in the Command message instead of calling DisplayCorrectGroup you should call _DrawQuickTabGroup like so:
def Command(self, id, msg):
if id == ID_QUICKTAB_BAR and self._quickTab:
self._DrawQuickTabGroup()
return True
Regarding your question and classic Tab, find an example in Remove a GeDialog Tab Group but as you can see this is also not possible to remove a tab without redrawing everything .
Cheers,
Maxime.