Announcement

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

    Retrieving the scroll direction/delta value from scrolled notification

    SmartClient Version: v9.1p_2015-09-16/Pro Development Only (built 2015-09-16)
    Any browser, any version

    When the scroll bar is being dragged with the mouse, the "scrolled" function is being notified. The documentation says to use the "observe" method to handle scroll notifications. I would like to know which direction the scroll is doing by either having a direct implication of which direction it is scrolling or a delta value (much like isc.EventHandler.getWheelDeltaY()). When observing the "scrolled" method, there are two arguments being passed in that are not documented. The second argument being the delta value is what I need But I am reluctant in using these arguments as they are not documented. Should I go ahead and use the second argument as the delta value and assume it is future-proof?

    The code below displays the arguments on the side. The variables "a", and "b" are undocumented in the "scrolled" function. If these are not future-proof, is there another way to achieve similar result for determining delta value or direction?

    Code:
    isc.Label.create({
        ID: "label",
        contents: "Arguments: "
    });
    isc.VLayout.create({
        width: "100%",
        height: "100%",
        overflow: "auto",
        members: [
            isc.Canvas.create({
                width: "100%",
                height: 2500
            })
        ],
        initWidget: function() {
            this.Super("initWidget", arguments);
            this.observe(this, "scrolled", function(a, b) {
                label.setContents("Arguments: " + a + ", " + b);
            });
        }
    });

    #2
    These arguments are undocumented by design because they expose information that differs by browser (and in some cases by browser version).

    To calculate a delta, save the last scroll position and compare.

    Comment

    Working...
    X