Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Register
    • Login

    LayoutFlushGroup doesn't place the insertion point inside the group

    Cinema 4D SDK
    r19 c++ windows
    3
    5
    1.1k
    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.
    • P
      peterakos
      last edited by peterakos

      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.

      1 Reply Last reply Reply Quote 0
      • N
        neon
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • P
          peterakos
          last edited by

          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 😞

          1 Reply Last reply Reply Quote 0
          • P
            peterakos
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • S
              s_bach
              last edited by

              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

              MAXON SDK Specialist

              Development Blog, MAXON Registered Developer

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