Layout not scrolling

12 views
Skip to first unread message

howud...@gmail.com

unread,
Feb 4, 2018, 10:50:30 AM2/4/18
to CodenameOne Discussions
I have an entry dialog that doesn't scroll even though I have set scrollable Y to true.  here is a test case that shows the problem.  I have tried setting scrollableY on both the outer container and the inner container.  NB:  I know the form is really tiny, I have done that on purpose to demonstrate the scrolling issue

protected class DLGTest extends Dialog {
protected Button btnApply = new Button(FontImage.createMaterial(FontImage.MATERIAL_DONE, UIManager.getInstance().getComponentStyle("Command"), 5));
protected Button btnClose = new Button(FontImage.createMaterial(FontImage.MATERIAL_CLEAR, UIManager.getInstance().getComponentStyle("Command"), 5));
protected TextField tfLine1 = new TextField();
protected TextArea taNotes = new TextArea();
protected CheckBox cbStudy = new CheckBox();
protected TextField tfMaterial = new TextField();
public DLGTest() {
    taNotes.setRows(5);

    this.setLayout(new BorderLayout());
        this.setScrollableY(true);
        
        btnApply.setUIID("Label");
        btnClose.setUIID("Label");
    btnApply.addActionListener(evt -> dispose());
    btnClose.addActionListener(evt -> dispose());

    Container cntButtons = new Container(new FlowLayout(RIGHT));
    cntButtons.add(btnApply);
    cntButtons.add(btnClose);

    TableLayout tl = new TableLayout(1,2);
    Container cnt2 = new Container(tl);
    cnt2.add(tl.createConstraint().horizontalSpan(1).widthPercentage(25), new Label());
    cnt2.add(tl.createConstraint().horizontalSpan(1).widthPercentage(75), new Label());
    cnt2.add(tl.createConstraint().horizontalSpan(1), new Label("Line 1"));
    cnt2.add(tl.createConstraint().horizontalSpan(1), tfLine1);
    cnt2.add(tl.createConstraint().horizontalSpan(1), new Label("Material"));
    cnt2.add(tl.createConstraint().horizontalSpan(1), tfMaterial);
    cnt2.add(tl.createConstraint().horizontalSpan(1), new Label("Study"));
    cnt2.add(tl.createConstraint().horizontalSpan(1).horizontalAlign(Component.LEFT), cbStudy);
    cnt2.add(tl.createConstraint().horizontalSpan(1), new Label("Notes"));
   
    Container cnt1 = new Container(new BorderLayout());
    cnt1.add(BorderLayout.NORTH, cnt2);
    cnt1.add(BorderLayout.CENTER, taNotes);
        cnt1.setScrollableY(true);
    this.add(BorderLayout.NORTH, cntButtons);
    this.add(BorderLayout.CENTER, cnt1);
}
}
new DLGTest().show(20, (int)(Display.getInstance().getDisplayHeight()*.7)-20, 10, 10, true, true);



Shai Almog

unread,
Feb 5, 2018, 12:06:36 AM2/5/18
to CodenameOne Discussions
A border layout can't be scrollable.
Reply all
Reply to author
Forward
0 new messages