Announcement

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

    Canvas.getScrollbar() deprecated

    SmartClient Version: v12.1p_2021-10-22/PowerEdition Deployment (built 2021-10-22)

    We have an OLD SmartGWT application which I am trying to resurrect, and I see this Warning: "the method getScrollbar() from ListGrid is deprecated"

    I wonder how to replace this deprecated call.

    If I look at the documentation at: https://smartclient.com/smartgwt-12....artgwt/client/ for the ListGrid class, the getScrollbar() is not documented.

    the call returns a Canvas object.

    In another class derived from VLayout, there is this code line: ( I assume fetching the scrollbar and adjusting the current canvas and then adding it to the VLayout derived class).

    Code:
    //  Container is a derived VLayout class,; the class contains a ListGrid as a component.  
    // The author is getting the left edge of the scrollbar of the ListGrid component.
    
    container.getScrollbar().setLeft(container.getAbsoluteLeft() - getAbsoluteLeft());
     addMember(container.getScrollbar());
    I didn't write this code, and it wasn't documented by that person.

    I assume that the author was getting a Scrollbar Object, and then setting the left edge of the class Canvas so that it didn't occlude the the scrollbar of the grid - or something like that.

    Since there is no documentation on Listgrid.getScrollbar() or on Canvas.getScrollbar that I can find, what do you recommend I replace this with?
    Last edited by tece321; 11 May 2023, 10:04. Reason: Correct the English

    #2
    From a first look it's not clear to us what this code is trying to achieve.

    There isn't currently a getScrollbar() framework API, and it's not immediately obvious to us how this is working at all in 12.1, even with a deprecated warning.

    If there were such a method and it did the obvious thing of returning the automatically generated Scrollbar instance for an overflow "auto" or "scroll" component, attempting to modify its position or add it as a member to another component seems like it would never work.

    If the code is attempting to adjust the size of content based on whether or not a scrollbar is showing we'd recommend looking at getInnerWidth, getInnerContentWidth and getViewportWidth

    Beyond that we'd need some more information to comment intelligently

    Sorry we can't be more help

    Isomorphic Software

    Comment


      #3
      As an aside there are a couple of old Broadcom forum threads which could possibly be relevant to this code:

      This was a discussion related to scrollbar placement and sizing

      https://forums.smartclient.com/forum...-width?t=27923


      And this was a discussion about creating a custom scrollbar from scratch:


      https://forums.smartclient.com/forum...ing#post267178

      Regards

      Comment


        #4
        Thanks for the response.

        We will have to investigate more on our side to see if we can decipher what the author was attempting to do here.

        To move on, I will remove this code and any references to getScrollbar() calls. I looked at documentation for 6.0 and 6.1 versions and don't see any documentation on getScrollbar() either, so I don't know where the author got this usage.

        I don't believe your references apply to this usage., but thanks for them.

        Best wishes

        Comment

        Working...
        X