Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    leaveScrollbarGap not working as expected

    SmartClient Version: v10.0p_2015-03-10/Pro Deployment (built 2015-03-10)

    I have a problem with a layout where setLeaveScrollbarGap(true) doesn't work.

    I have created the following test case which shows the problem.

    Code:
    public Layout getMainLayout() {
    	
    	final VLayout mainLayout = new VLayout();
    	
    	HLayout layout1 = new HLayout(5);
    	layout1.setHeight(100);
    	layout1.setWidth(200);
    	layout1.setOverflow(Overflow.AUTO);
    	layout1.setLeaveScrollbarGap(true);
    	layout1.setBorder("2px solid blue");
    	layout1.setMembers(getLayouts(4,50));
    	
    	HLayout layout2 = new HLayout(5);
    	layout2.setMinMemberSize(100);
    	layout2.setHeight(100);
    	layout2.setWidth(200);
    	layout2.setOverflow(Overflow.AUTO);
    	layout2.setLeaveScrollbarGap(true);
    	layout2.setBorder("2px solid red");
    	layout2.setMembers(getLayouts(4,50));
    	
    	HLayout layout3 = new HLayout(5);
    	layout3.setHeight(100);
    	layout3.setWidth(200);
    	layout3.setOverflow(Overflow.AUTO);
    	layout3.setLeaveScrollbarGap(true);
    	layout3.setBorder("2px solid green");
    	layout3.setMembers(getLayouts(4,200));
    	
    	HLayout layout4 = new HLayout(5);
    	layout4.setMinMemberSize(100);
    	layout4.setHeight(100);
    	layout4.setWidth(200);
    	layout4.setOverflow(Overflow.AUTO);
    	layout4.setLeaveScrollbarGap(true);
    	layout4.setBorder("2px solid yellow");
    	layout4.setMembers(getLayouts(4,200));
    	
    	mainLayout.addMember(layout1);
    	mainLayout.addMember(layout2);
    	mainLayout.addMember(layout3);
    	mainLayout.addMember(layout4);
        
    	return mainLayout;
    }
    
    private VLayout[] getLayouts(int numOfLayouts, int height)
    {
    	VLayout[] layouts = new VLayout[numOfLayouts];
    	
    	for (int i = 0; i < numOfLayouts; i++) {
    		VLayout layout = new VLayout();
    		layout.setHeight(height);
    		layout.setBackgroundColor("black");
    		layouts[i] = layout;
    	}
    	return layouts;
    }
    I expected layout2 to display the same kind of gap as layout1 but as you can see in the screenshot, that is not the case.

    Am I misunderstanding the intended behavior or is this a bug?
    Attached Files

    #2
    The purpose of leaving a scrollbar gap (per the docs):

    This setting avoids the layout resizing all members when the vertical scrollbar is introduced or removed, which can avoid unnecessary screen shifting and improve performance.
    In this scenario, the members of the Layout have already overflowed the width of the layout; they will not be reduced in width by the vertical scrollbar, if one is introduced.

    Comment

    Working...
    X