Group issues



  • On 19/04/2015 at 05:20, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R14 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi folks,

    I apologise in advance for this, but I'm at boiling point. Rant proceeds. The dialog system in Cinema is atrocious.

    As an example, I've got a dialog setup where there's 3 groups which I want to expand across and fill a horizontal space. So I use the BFH_SCALEFIT flag in each group, thinking that this will expand each of the groups to the largest size possible in the given area (in this case, a third for each group). For the purposes of illustrating it, lets say the dialog is 1800 wide. So each group should get 600 pixel units to work with if there were 3 groups.

    Now, if I start with just two groups, the dialog works fine and each group shares half the space (two groups with 900 pixels each). But if I uncomment the third group (and rebuild), the dialog layouts main group resizes itself (shrinks) and I'm left with a gapping big gap in the dialog with nothing in it. So, each group now has say 200 pixels, the main dialog group is now 600 pixels (3x200) and there's a 1300 pixel gap on the right hand side with nothing in it.

    The dialog's main group is using the same scaling flag. So as I understand it, it should be scaling to 1800 pixels. Is my understanding here correct? Or is the BFH_SCALEFIT flag meant to do something else?

    Why are hopelessly simple tasks like this so difficult to achieve in this system? Is it me not understanding the docs and how groups and layouts work? Or is it the flags system not doing what they should be doing? Is it an underlying system architecture thing? Something else?

    And why are we not able to have a simple plain group with nothing in it? Things like this can be used as spacers, indents, colour fills etc. Why can't we just have a plain group that's x-pixels wide by y-pixels high without needing something else in it for the group to be 'valid'?

    Is it me? Or is it the system?

    WP.



  • On 19/04/2015 at 05:27, xxxxxxxx wrote:

    It is my experience that if you want items to be equally spaced, you have to specify it at the next higher group level.  So, for instance, to space three groups evenly horizontally, you need to put them under a group with the BFH_SCALEFIT flag and 3 for columns.  While this is not intuitive, it eventually makes some sense.  Remember that groups do not need to be 'visible'.  They can be used for invisible herding and control of their contained items.



  • On 19/04/2015 at 11:00, xxxxxxxx wrote:

    Hi Robert,

    I wasn't sure how much info I should provide, didn't want to flood the post. But I probably need to give a little more to paint the picture.

    As a habbit, I put multiple groups under singular groups, which I draw in another function. I don't do this all the time, only when I need to flush and rebuild groups. Here's some psuedo code to give you an idea of how I set it up:

      
      
    Bool MyDialog::CreateLayout(void)   
    {   
        GroupBegin(Group_id_1,BFH_SCALEFIT|BFV_SCALEFIT,1,2,"",NULL);   
        GroupBorderNoTitle(BORDER_NONE);   
        GroupBorderSpace(0,0,0,0);   
        GroupSpace(0,0);   
            GroupBegin(Group_id_2,BFH_SCALEFIT|BFV_SCALEFIT,1,1,"",NULL);   
            GroupBorderNoTitle(BORDER_NONE);   
            GroupBorderSpace(0,0,0,0);   
            GroupSpace(0,0);        
                DrawMultipleGroups(FALSE);   
            GroupEnd();   
                 
            GroupBegin(Group_id_10,BFH_SCALEFIT|BFV_SCALEFIT,1,1,"",NULL);   
            GroupBorderNoTitle(BORDER_NONE);   
            GroupBorderSpace(0,0,0,0);   
            GroupSpace(0,0);        
                // draw next group here etc..   
            GroupEnd();             
        GroupEnd();   
            
         Set_Layout(1);   // hides/unhides groups associated with layouts   
         Set_Hidden(1);   // hides/unhides groups/elements in specific areas   
    }   
      
    void MyDialog::DrawMultipleGroups(bool Flush)   
    {   
        if(Flush == TRUE)   
        {   
            LayoutFlushGroup(Group_id_2);   
        }   
      
        GroupBegin(Group_id_3,BFH_SCALEFIT|BFV_SCALEFIT,3,1,"",NULL);   
        GroupBorderNoTitle(BORDER_NONE);   
        GroupBorderSpace(0,0,0,0);   
        GroupSpace(0,0);   
            GroupBegin(Group_id_4,BFH_SCALEFIT|BFV_SCALEFIT,1,1,"",NULL);   
            GroupBorderNoTitle(BORDER_NONE);   
            GroupBorderSpace(0,0,0,0);   
            GroupSpace(0,0);   
                // add elements here..   
            GroupEnd();             
      
             GroupBegin(Group_id_5,BFH_SCALEFIT|BFV_SCALEFIT,1,1,"",NULL);   
            GroupBorderNoTitle(BORDER_NONE);   
            GroupBorderSpace(0,0,0,0);   
            GroupSpace(0,0);   
                // add elements here..   
            GroupEnd();             
            
            GroupBegin(Group_id_6,BFH_SCALEFIT|BFV_SCALEFIT,1,1,"",NULL);   
            GroupBorderNoTitle(BORDER_NONE);   
            GroupBorderSpace(0,0,0,0);   
            GroupSpace(0,0);   
                // add elements here..             
            GroupEnd();   
        GroupEnd();   
      
        if(Flush == TRUE)   
        {   
            LayoutChanged(Group_id_2);   
        }   
    }   
      
    

    I'm trying to dig out any errors by commenting things out etc, but I'm not finding any issues anywhere else. That's not to say there isn't one mind you. Something else may be causing the problem. But the error itself only ever happens when the three groups are added. It works fine with all three commented out, and it works fine with two. But with three, the layout is ruined.

    The dialog in question I must admit is quite complex. I would post screen shots but due to licensing and trademark reasons I can't just yet. But the dialog has been carefully built. Every group has been meticulously made, and added one at a time to test the layout and group integrity. As mentioned, the issue only ever happens when these three groups are added.

    WP.



  • On 19/04/2015 at 12:39, xxxxxxxx wrote:

    This code works for me.  It could be the use of 1 instead of 0.  I always use 0 unless the grouping is planar (NxM grid).  Otherwise, the number of rows or columns and 0 for the other.

    	GroupBegin(IPTD_LOG,BFH_SCALEFIT|BFV_SCALEFIT,3,0,"Log",0L);
    	GroupBorderSpace(8, 8, 8, 8);
    		GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,0,1,"Log",0L);
    		GroupBorderSpace(8, 8, 8, 8);
    			m_pLog = AddMultiLineEditText(5001,BFH_SCALEFIT|BFV_SCALEFIT,0L,96L,DR_MULTILINE_READONLY|DR_MULTILINE_WORDWRAP);
    		GroupEnd();
    		GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,0,1,"Log",0L);
    		GroupBorderSpace(8, 8, 8, 8);
    			m_pLog = AddMultiLineEditText(5002,BFH_SCALEFIT|BFV_SCALEFIT,0L,96L,DR_MULTILINE_READONLY|DR_MULTILINE_WORDWRAP);
    		GroupEnd();
    		GroupBegin(0,BFH_SCALEFIT|BFV_SCALEFIT,0,1,"Log",0L);
    		GroupBorderSpace(8, 8, 8, 8);
    			m_pLog = AddMultiLineEditText(5003,BFH_SCALEFIT|BFV_SCALEFIT,0L,96L,DR_MULTILINE_READONLY|DR_MULTILINE_WORDWRAP);
    		GroupEnd();
    	GroupEnd();
    


  • On 19/04/2015 at 16:27, xxxxxxxx wrote:

    Ok, apparently it looks like it's something to do with using the BFH_SCALEFIT along with sizing attributes. I don't use SizePix() when using the scale fit flags, so I must have changed them later to the BFH_SCALEFIT flag without removing the SizePix(). I'm a little surprisd the system can't handle them together - why not just ignore any sizes if the scale fit flag is passed? Don't know if that is the underlying issue, maybe it isn't. But anyway. The groups are scaling better, they're almost there.

    I was up all day yesterday fiddling, and all of last night, and if it weren't for being 9:30am Monday morning now, I'd go to bed. But instead, I'll have a shower, have a second breakfast, and get back into it I guess. What a way to start a week. It's going to be a long one. Thanks Robert,

    WP.



  • On 20/04/2015 at 17:29, xxxxxxxx wrote:

    Hope you got some sleep and good to know that you have it under control! :)


Log in to reply