[Python] Getting GeDialog QuickTabs to Align Horizontally


Hello, I’m trying to get my Quick Tabs in a horizontal line like so:

This only works if I specify a width, but the layout to be dynamic as the text will change. I tried getting the TextWidth before appending the Strings, but did not have success. To get the tabs to center in the GeDialog without knowing the width, I need to set the minw to 0, which forces the tabs into vertical alignment.

How can I get them to align horizontally without having a fixed width beforehand? Thank you!

import c4d
from c4d import gui

class Dlg(gui.GeDialog):
    def CreateLayout(self):
        bc = c4d.BaseContainer()
        bc.SetBool(c4d.QUICKTAB_SHOWSINGLE, True)
        bc.SetBool(c4d.QUICKTAB_NOMULTISELECT, True)
        self.quicktabs = self.AddCustomGui(1000, c4d.CUSTOMGUI_QUICKTAB, "",
                c4d.BFH_CENTER | c4d.BFH_SCALE | c4d.BFV_CENTER | c4d.BFV_SCALE, 0, 0, bc)
        self.quicktabs.AppendString(0, "Item 1", False)
        self.quicktabs.AppendString(1, "Item 2", False)
        self.quicktabs.AppendString(2, "Item 3", False)
        self.quicktabs.Select(0, True)
        return True

def main():
    global dlg
    dlg = Dlg()
    dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC, xpos=-2, ypos=-2,
        defaultw=900, defaulth=561)

if __name__=='__main__':




to force all tabs in one row. That works with 0 widths.


@Cairyn Thank you very much :slight_smile: I thought I had tried that. I was up late. :smiley: