Announcement

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

    the resizeBar sizes for the outer container, not the widget it is shown for.

    SmartClient Version: v11.1p_2017-08-08/PowerEdition Deployment (built 2017-08-08)
    Chrome

    I have a larger layout (blue) that houses a smaller ListGrid (green). The grid has a resize bar associated with it. How do I fit the resizeBar to the width of the grid and not the outer container?

    i.e.

    final VLayout outsideLayout = new VLayout();
    outsideLayout.setWidth(200);
    outsideLayout.setHeight(200);
    outsideLayout.setBorder("3px solid blue");

    final ListGrid grid = new ListGrid();
    grid.setWidth(100);
    grid.setHeight(100);
    grid.setBorder("3px solid green");
    grid.setShowResizeBar(true);

    outsideLayout.addMember(grid);

    In general, this scenario looks like this:
    Click image for larger version

Name:	resizeBarTooLarge.png
Views:	64
Size:	1.2 KB
ID:	251531




















    One would expect the resizeBar to work something like the following hackery. If I add it, the resize bar starts off sized as desired. However, as I show or hide list grid fields, the resize bar bounces between the width of the grid and the width of the container sporadically and inconsistently. I suspect there is a race condition that needs some overriding as well.

    // pathetic hackery
    grid.addResizedHandler(new ResizedHandler() {
    @Override
    public void onResized(ResizedEvent event) {
    //Canvas resizeBar = grid.getCanvasAutoChild("resizeBar");
    Canvas resizeBar = Canvas.getById(outsideLayout.getID() + "_resizeBar");
    if (resizeBar != null){
    int newWidth = grid.getBody().getInnerContentWidth();
    resizeBar.setWidth(newWidth);
    }
    }
    });

    #2
    In this situation you could place your grid into a sub-layout that is only as wide as the grid and the resizeBar would then be that large. However, we can't really tell if this solves your problem, because surely this isn't the actual layout you want, since there would be no point in leaving blank space to the right of the grid.

    Comment

    Working...
    X