What message or Id do I get when the user select a tab in my dialog?



  • I have a command plugin with a dialog (1 res file).
    Is there a way to detect that the user clicked a tab in the dialog.
    So, not a button or any other field, but a tab?


  • Global Moderator

    Hi @pim you can access the current TabID by querying GetInt32 on the TabGroup's ID.

    Here you get a complete example of tab usage.

    import c4d
    
    class Dlg(c4d.gui.GeDialog):
        def CreateLayout(self):
            if self.TabGroupBegin(1000, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, tabtype=c4d.TAB_TABS):
                
                if self.GroupBegin(1001, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, title="First Tab", groupflags=c4d.BFV_BORDERGROUP_FOLD_OPEN):
                    self.GroupEnd()
                    
                if self.GroupBegin(1002, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 0, title="Second Tab", groupflags=c4d.BFV_BORDERGROUP_FOLD_OPEN):
                    self.GroupEnd()
    
            self.GroupEnd()
            self.AddButton(1003, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, name="Activate second Tab")
            
            return True
        def Command(self, id, msg):
            # Id of the TabGroupBegin
            if id == 1000:
                print self.GetInt32(1000)
                
            # Id of the Button
            if id == 1003:
                self.SetInt32(1000, 1002)
            
            return True
        
    # Main function
    def main():
        dlg = Dlg()
        dlg.Open(c4d.DLG_TYPE_MODAL_RESIZEABLE)
    
    # Execute main()
    if __name__=='__main__':
        main()
    

    Finally please read and stick to the How to Post Questions (especially about tagging system).

    If you have any question, please let me know.
    Cheers,
    Maxime!



  • Thank you!
    In future I will set the tags.