SOLVED Remove a GeDialog Tab Group

Hello,
I'm trying to remove a GeDialog Tab Group. Is this possible without flushing the Layout and redrawing all of the groups? Thank you

import c4d
from c4d import gui

PLUGIN_ID = 123456
MAIN_GROUP = 10000
GROUP_1 = 10001
GROUP_2 = 10002
GROUP_BTN = 10003
TEXT_1 = 2001
TEXT_2 = 2002
DELETE_GRP_BTN = 2003

class MyDialog(c4d.gui.GeDialog):
    def CreateLayout(self):
        self.SetTitle("Remove Group")
        if self.TabGroupBegin(MAIN_GROUP, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, tabtype=c4d.TAB_TABS):
            if self.GroupBegin(GROUP_1, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 3, 0, "Group 1"):
                self.GroupBorderSpace(10,10,10,10)
                self.AddStaticText(TEXT_1, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, "Group 1", c4d.BORDER_THIN_IN)
            self.GroupEnd()
            if self.GroupBegin(GROUP_2, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 3, 0, "Group 2"):
                self.GroupBorderSpace(10,10,10,10)
                self.AddStaticText(TEXT_2, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, "Group 2", c4d.BORDER_THIN_IN)
            self.GroupEnd()
        self.GroupEnd()
        if self.GroupBegin(GROUP_BTN, c4d.BFH_SCALEFIT | c4d.BFV_BOTTOM, 0, 0, ""):
            self.GroupBorderSpace(10,10,10,10)
            self.AddButton(DELETE_GRP_BTN, c4d.BFH_LEFT, initw=0, inith=0, name='DELETE')
        self.GroupEnd()
        return True

    def Command(self, id, msg):
        if id == DELETE_GRP_BTN:
            self.RemoveElement(GROUP_1)
            self.LayoutChanged(MAIN_GROUP)
            #self.SetInt32(MAIN_GROUP, GROUP_2)
        return True

if __name__=='__main__':
    global myDlg
    myDlg = MyDialog()
    myDlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC, xpos=-2, ypos=-2, \
                pluginid=PLUGIN_ID, defaultw=400, defaulth=350)

Hi @blastframe unfortunately, in Python there is no way, and you are right the correct thing is to flush and regenerate all the layout.
This is for sure not possible in Python, in C++ it may be possible via UpdateDialogHelper.
If you are interested in a C++ solution I can look further.

Cheers,
Maxime.

Hi @blastframe unfortunately, in Python there is no way, and you are right the correct thing is to flush and regenerate all the layout.
This is for sure not possible in Python, in C++ it may be possible via UpdateDialogHelper.
If you are interested in a C++ solution I can look further.

Cheers,
Maxime.

@m_adam I'm good with using Python this way. Thanks Maxime.