Quick Tab Radio for GeDialog?



  • 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?



  • 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()
    


  • 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)
    


  • @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.


Log in to reply