Hello

I want to scroll a widget in a scrollcontainer to the center and enrich this
scrolling with an transition. But I didn't found a possibility to get an
effect for scrolling in a scrollcontainer, nor did I found an easy way of
position the widget in the center of the container.

Does anyone have an example of how to accomplish this?

/Kind regards

Christian

//------------------------------------------------------------------------------
//A playgorund example would be (look at the comment):
//------------------------------------------------------------------------------
qx.Class.define("demobrowser.demo.ui.ScrollContainer",
{
  extend : qx.application.Standalone,

  members :
  {
    main: function()
    {
      this.base(arguments);

      var scrollContainer = new qx.ui.container.Scroll();
      scrollContainer.set({
        width: 300,
        height: 360
      });

      scrollContainer.add(this.generateBoxes());
      this.getRoot().add(scrollContainer, {left: 10, top: 10});

      var toggle = new qx.ui.form.Button("Scroll").set({
        padding : 5
      });

      toggle.addListener("execute", function()
      {
        var widget = scrollContainer.getChildren()[0].getChildren()[49];
        widget.setBackgroundColor("white");
        scrollContainer.scrollToX(0);
//scroll to center here with sinodial effect
        scrollContainer.scrollChildIntoView(widget);

      });

      this.getRoot().add(toggle, {left: 10, top: 400});
    },

    generateBoxes : function()
    {
      var box = new qx.ui.container.Composite(new qx.ui.layout.Grid());

      for (var y=0; y<5; y++)
      {
        for (var x=0; x<32; x++)
        {
          box.add((new qx.ui.core.Widget("" + x + "_" + y)).set({
            backgroundColor : ((x+y) % 2 == 0) ? "red" : "blue",
            width : 60,
            allowShrinkY : false,
            allowShrinkX : false,
            height : 60
          }), {column: x, row: y});
        }
      }

      return box;
    }
  }
});
//------------------------------------------------------------------------------
-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Scroll-widget-in-qx-ui-container-Scroll-to-the-center-tp4985084p4985084.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to