[Project_owners] Scrolling a horizontal scrollbox

Brian King brian at mozdev.org
Thu Jun 2 16:57:43 EDT 2005


I have a scrollbox [horizontal] populated with multiple label elements.
I want to flow through it via script, i.e. scroll it at a given interval.

JS looks like this:

   Scroll : function()
   {
     var scrollbox = document.getElementById("ticker-bar").childNodes[1];
     var scrollboxObj =
scrollbox.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
     var x = {};
     var y = {};
     scrollboxObj.getPosition(x, y);
     dump(y.value + "-" + x.value+"\n");
     scrollboxObj.scrollTo(0,y.value+10)
     setTimeout(this.setScrollInterval, 1000);
   },

I verified that the scrollbox element is being grabbed correctly, but
nsIScrollBoxObject.getPosition is always returning {0, 0} on each iteration.

One thing to note is that the scrollbox is part of a XUL template which
generates the labels.

Any ideas, or alternative ways I could scroll such content?

-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community


More information about the Project_owners mailing list