LayoutFlushGroup doesn't place the insertion point inside the group



  • Hello.

    I have the following simplified resource dialog.

    TAB TAB_GROUP {
        GROUP TAB1{
            NAME TAB1;
        }
        GROUP TAB2{
            NAME TAB2;
            SCROLLGROUP {
                GROUP GROUP_TO_FLUSH {
                }
            }
        }
    }
    

    The problem is that the following code doesn't place the button in the flushing group.

    LayoutFlushGroup(GROUP_TO_FLUSH );
    AddButton(....);
    LayoutChanged(GROUP_TO_FLUSH );
    

    I load the resource file using LoadDialogResource, but I fill the flushing group via code.
    After flushing the group, the button appears below the tab group.
    How Can I place the insertion point in the GROUP_TO_FLUSH ?

    Thank you.



  • Hey peterakos,

    as far as I know once you flushed the group you have to do something like this:

    self.LayoutFlushGroup(GROUP_TO_FLUSH)
    self.GroupBegin(GROUP_TO_FLUSH, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 1,1,"",0)
    
    self.AddButton(....)
    
    self.GroupEnd()
    self.LayoutChanged(GROUP_TO_FLUSH)
    

    that worked for me. Hope it helps,
    regards,
    neon



  • I think you must not Begin the same group as the one you are flushing.
    It appears that the purpose of LayoutFlushGroup is to clear the group of controls and start adding to it directly.

    I've tested your suggestion but it didn't work :(



  • Hello again.

    Adding all the controls via code and removing the LoadDialogResource solves the issue. For some reason you cannot use both LoadDialogResource and Adding/Flushing the controls manually.

    Thank you.


  • Global Moderator

    Hello,

    LoadDialogResource() and LayoutFlushGroup() should work perfectly fine together. Typically LayoutFlushGroup() is called in reaction to some user interaction or in InitValues():

    Bool CreateLayout()
    {
      if (!GeDialog::CreateLayout())
        return false;
    
      if (!LoadDialogResource(11000, nullptr, 0))
        return false;
      return true;
    }
    
    Bool InitValues()
    {
      LayoutFlushGroup(11003);
      AddButton(100, BFH_SCALEFIT, 0, 10, "Button"_s);
      LayoutChanged(11003);
    
      return true;
    }
    

    best wishes,
    Sebastian