Announcement

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

    Scrollbar thumb sizing

    I want to add an Hscrollbar to a VStack and manual controll the scrolling.

    VStack fooVstach = new VStack();
    Scrollbar hTaskChartScroll = new Scrollbar();
    hTaskChartScroll.setVertical(false);
    hTaskChartScroll.setAutoEnable(false);
    hTaskChartScroll.addScrolledHandler(new ScrolledHandler() {
    public void onScrolled(ScrolledEvent event) {
    GWT.log("scroll!!");
    }
    });
    fooVstack.addMember(hTaskChartScroll);

    Previous code correctly add the scrollbar, but the thumb is large as much as the width, so it doesn't scroll.

    How to control the thumbSize?

    [Smartgwt 2.5 + Gwt 2.3 + firefox/chrome]
    Attached Files

    #2
    perhaps you have forget to add "setScrollTarget" or "setThumb" methods ?
    I looked at Scrollbar.js ...

    //> @attr scrollbar.scrollTarget (Canvas : null : [IRWA])
    // The widget whose contents should be scrolled by this scrollbar. The scrollbar thumb
    // is sized according to the amount of visible vs. scrollable content in this widget.
    // @visibility external
    //<

    Comment


      #3
      on SmartClient Version: v12.1p_2021-10-22/PowerEdition Deployment (built 2021-10-22) : I can't get the Scrollbar to even draw. Using this example I get the following exception. Can you verify that for me. Thanks.

      Code:
      18:27:31.984:WARN:Log:Uncaught exception escaped: com.google.gwt.core.client.JavaScriptException
      (TypeError) : Cannot read properties of undefined (reading 'create')
          at rmn_g$(Scrollbar.java:172)
          at Zd_g$(BaseWidget.java:745)
          at vw_g$(Layout.java:1871)

      Comment


        #4
        The previous customer's sample code from 2011 wasn't complete and had bugs - and perhaps there were framework bugs also, at that time.

        Trying today, with a complete test-case, we see things work as expected, without errors.

        Here's our test-case

        Code:
        // narrow stack
        VStack stack = new VStack();
        stack.setWidth(300);
        
        // narrow layout, clipping content
        VLayout layout = new VLayout();
        layout.setWidth(300);
        layout.setOverflow(Overflow.HIDDEN);
        
        // but containing a wide canvas
        Canvas c = new Canvas();
        c.setWidth(500);
        c.setBackgroundImage(Canvas.getImgURL("[SKINIMG]actions/edit.png"));
        layout.addMember(c);
        
        // scrollbar attached to the clipped layout
        Scrollbar scrollbar = new Scrollbar();
        scrollbar.setVertical(false);
        scrollbar.setScrollTarget(layout);
        
        stack.addMember(layout);
        stack.addMember(scrollbar);
        stack.draw();
        Last edited by Isomorphic; 16 Jan 2022, 00:46.

        Comment

        Working...
        X