I am sorry,
as i said on my mail before to accelerate the load time off qooxdoo
projects I just turned in. It looks like, that I have to reload
completely if I use a new framework class in my project. So sorry, for
disturbing you. Derrell your code works excellent like every time.
Regards Mustafa
________________________________
Von: Mustafa Sak
Gesendet: Samstag, 4. April 2009 11:45
An: qooxdoo Development
Betreff: Re: [qooxdoo-devel] toggle scrollbar at bottom on a scroll
container
Hi Derrell,
That's strange. I can't access to any object inside the timer callback
function. Every dump of any object, even 'this', ruterns just null. What
am I doing wrong?
Regards
Mustafa Sak
qx.Class.define("chat.Application",
{
extend : qx.application.Standalone,
members :
{
/**
* This method contains the initial application
code and gets called
* during startup of the application
*/
main : function()
{
var _this = this;
// Call super class
this.base(arguments);
var main = new
qx.ui.container.Composite(new qx.ui.layout.VBox());
this.getRoot().add(main);
scrollContainer = new
qx.ui.container.Scroll();
scrollContainer.set(
{
width: 300,
height: 300
});
main.add(scrollContainer);
var cont = new
qx.ui.container.Composite(new qx.ui.layout.VBox()).set({backgroundColor:
"green"});
scrollContainer.add(cont);
main.add(testBnt= new
qx.ui.form.Button("Test"));
testBnt.addListener("execute",
function(e)
{
for (i=0;i<100 ;i++ )
{
cont.add(x =
_this.generateBox(i));
}
var timer =
qx.util.TimerManager.getInstance();
// start an immediate
one-shot timer
timer.start(function(userData, timerId)
{
console.log(scrollContainer.getItemBottom(cont)); // returns null
scrollContainer.scrollToY(scrollContainer.getItemBottom(cont));
});
});
},
generateBox : function(i)
{
var cont = new
qx.ui.container.Composite(new qx.ui.layout.VBox()).set(
{
backgroundColor: "white",
padding: 5
});
var chatVerlauf = new
qx.ui.basic.Label(i + ". <strong>AAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA</strong>").set(
{
backgroundColor: "white",
rich: true,
selectable : true
});
cont.add(chatVerlauf);
return cont;
}
}
});
________________________________
Von: Derrell Lipman [mailto:[email protected]]
Gesendet: Samstag, 4. April 2009 00:30
An: qooxdoo Development
Betreff: Re: [qooxdoo-devel] toggle scrollbar at bottom on a scroll
container
On Fri, Apr 3, 2009 at 5:59 PM, Mustafa Sak <[email protected]>
wrote:
i just want to toggle the y scroll of my scroll container to the bottom.
This feature is necessary for a chat application I think. So I thought I
could get the max scroll value with scrollContainer.getItemBottom(cont)
But if I add some widgets direct before the line of code, I just get the
value of the maximum y scroll value before adding these widgets. What am
I doing wrong?
Adding the widget doesn't actually add it to the DOM. Try putting your
scroll in a timeout so that the widget queue has time to get flushed:
var timer = qx.util.TimerManager.getInstance();
// start an immediate one-shot timer
timer.start(function(userData, timerId)
{
console.log(scrollContainer.getItemBottom(cont));
scrollContainer.scrollToY(scrollContainer.getItemBottom(cont));
});
There's also a way to manually flush the widget queue, but that's
generally considered bad form.
Derrell
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel