Dialog not resizing back to original size [CLOSED]

On 06/01/2015 at 17:17, xxxxxxxx wrote:

Press the '?', it extends the dialog to the right with a second group. Press it again and that second group disappears. However, it doesn't shrink the dialog back to it's original size.

How would I go about fixing this?

Also, do I need to have c4d.StopAllThreads () in there?

import c4d, os
from c4d import gui
from os import path
#Welcome to the world of Python
  
class dlg ( gui.GeDialog ) :
    LabelID = 999
    mainGroup = 1000
    
    secondGroup = 1020
    second = 10205
    sText = 1021
  
    buttonGrp = 1005
    okBtn = 1006
    cancelBtn = 1007
    secondBtn = 1008
    
    style = 2000
    
    def CreateLayout ( self ) :    
        self.SetTitle ( 'dlg test' )
        self.GroupBegin ( self.mainGroup, c4d.BFH_FIT, 2, 0 )
        
        self.GroupBegin (self.buttonGrp, 0, 3, 0, title = 'first group' )
        self.GroupBorderSpace( 8, 8, 8, 8 )
        self.AddButton ( self.okBtn, c4d.BFH_SCALEFIT, name = 'OK', initw = 250, inith = 18 )
        self.AddButton ( self.cancelBtn, c4d.BFH_SCALEFIT, name = 'Cancel', initw = 250, inith = 18 )
        self.AddButton ( self.secondBtn, c4d.BFH_SCALEFIT, name = '?', initw = 18, inith = 18 )
        self.GroupEnd ()
        
        self.GroupEnd ()
        
        if self.style == 2001:
            self.GroupBegin ( self.second, c4d.BFH_SCALEFIT, 1, 0, title = 'second group' )
            self.GroupBorder( c4d.BORDER_THIN_IN )
            self.GroupBorderSpace( 8, 8, 8, 8 )
            self.AddStaticText ( self.sText, c4d.BFH_LEFT, name = "after this is closed, resize dialog back to original." )
            self.GroupEnd ()
        self.GroupEnd ()
        return True
    
    def InitValues( self ) :
        return True  
    
    def CoreMessage ( self, id, msg ) :
        self.LayoutChanged ( c4d.EVMSG_CHANGEDSCRIPTMODE )
        return True
    
    def Command ( self, id, msg ) :
        # 'Cancel' Button
        if id == self.cancelBtn:
            self.Close ()
        # '?' Button
        if id == self.secondBtn:
            if self.style == 2001:
                self.style = 2000
            else:
                self.style = 2001
            self.LayoutFlushGroup ( self.mainGroup )
            self.CreateLayout ()
            self.InitValues ()
            self.LayoutChanged ( self.mainGroup )
        return True
            
def main() :
    c4d.StopAllThreads ()
    dialog = dlg ()
    dialog.Open ( c4d.DLG_TYPE_MODAL )
    
if __name__=='__main__':
    main()

On 07/01/2015 at 06:49, xxxxxxxx wrote:

Herbie,
I'm afraid I have no good news. There's currently no way to achieve this. Sorry 😢

On 07/01/2015 at 10:23, xxxxxxxx wrote:

Well then.. That's quite the bummer.

It was just a visual annoyance that I was trying to fix. I can get everything to work with the rest of the script.. it just won't look as pretty as I would like  😞