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

    Quick Tab Radio for GeDialog?

    Cinema 4D SDK
    r21 python
    2
    4
    648
    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.
    • B
      bentraje
      last edited by

      Hi,

      How do I create the 'quick tab radio' button in the gedialog?
      What I found so far is only "radio buttons".

      The c4d.gui.QuickTabCustomGui seems to be for actual tabs where you insert content and not like a button tab buttons.

      You can see what I am going for here:
      https://www.dropbox.com/s/5mik32wlhcwftcm/c4d204_quick_tab_radio_button_for_gedialog.jpg?dl=0

      There is a relative thread about it here but its not really conclusive.

      Is there a way around this?

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi bentraje, the QuickTab Radio widget is obtained by still using the QuickTabCustomGui.

        Find below a simplified snippet on how to get the result you'r looking for

        import c4d
        
        ID_QUICKTABSRADIO_BAR = 1000  # ID for the quicktab customGui
        
        class QuickTabRadio(c4d.gui.GeDialog):
        
            def __init__(self):
                self._quickTabRadio = None  # Stores the quicktab custom GUI
        
            def CreateLayout(self):
                # Creates a QuickTab Custom Gui
                bc = c4d.BaseContainer()
                bc.SetBool(c4d.QUICKTAB_SHOWSINGLE, True)
                bc.SetBool(c4d.QUICKTAB_NOMULTISELECT, True)
                self._quickTabRadio = self.AddCustomGui(ID_QUICKTABSRADIO_BAR, c4d.CUSTOMGUI_QUICKTAB, '',
                                                   c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, bc)
                self._quickTabRadio.AppendString(100, "FK", False)
                self._quickTabRadio.AppendString(200, "IK", False)
        
                return True
        
            def Command (self, id, msg):
                if id == ID_QUICKTABSRADIO_BAR and self._quickTabRadio:
                    if self._quickTabRadio.IsSelected(100):
                        print "FK is selected"
                    if self._quickTabRadio.IsSelected(200):
                        print "IK is selected"
        
                return True
        
        
        # Main function
        def main():
            # Initializes the dialog
            diag = QuickTabRadio()
        
            # Opens the dialog in modal mode
            diag.Open(dlgtype=c4d.DLG_TYPE_MODAL, defaultw=100, defaulth=100)
        
        
        # Execute main()
        if __name__ == '__main__':
            main()
        
        1 Reply Last reply Reply Quote 1
        • r_giganteR
          r_gigante
          last edited by

          Hi @bentraje, following up with a discussion with @s_bach (thanks for watching over) you can also consider the following implementation:

          import c4d
          
          ID_QUICKTABSRADIO_BAR = 1000  # ID for the quicktab customGui
           
          class QuickTabRadio(c4d.gui.GeDialog):
           
              def CreateLayout(self):
           
                 
                  items = c4d.BaseContainer()
                  items.SetString(1, "FK")
                  items.SetString(2, "IK")
                  
                  bc = c4d.BaseContainer()
                  bc.SetContainer(c4d.DESC_CYCLE, items)
                 
                  gadet = self.AddCustomGui(ID_QUICKTABSRADIO_BAR, 200000281, '',  c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, 0, bc)
                 
                  # set initial value
                  gadet.SetData(2)
                 
                  return True
           
              def Command(self, id, msg):
           
                  # react to interaction
                  if id == ID_QUICKTABSRADIO_BAR:   
                      value = msg[c4d.BFM_ACTION_VALUE]
                      print(value)
           
                  return c4d.gui.GeDialog.Command(self, id, msg)
          
          1 Reply Last reply Reply Quote 1
          • B
            bentraje
            last edited by

            @r_gigante

            Thank you for the response and especially for the alternative code (first time to see a line with msg[c4d.BFM_ACTION_VALUE].

            Both code works as expected.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post