Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Remove a GeDialog Tab Group

    Cinema 4D SDK
    python
    2
    3
    590
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      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)
      
      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @m_adam
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • M m_adam referenced this topic on
          • First post
            Last post