BUGREPORT: Stack-overflow on a locked scroll.......
Hi Alex, I am getting a stack overflow message when trying to drag the vertical scrollbar, I try to lock vertical-scroll with the following code:
Am I doing something wrong??
Is there any other way to lock the scrolling ??
Thanks
lastTopPos = obj.getScrollTop();
obj.onScrollTopChanged = function(){ obj.setScrollTop(lastTopPos);}
Carlos
December 17,
Any Sugestion/Idea apreciated (even a middle-crazy one)... ;-)
Thanks
Carlos
December 19,
Carlos,
calling setScrollTop() will raise onScrollTopChanged event, so you have a loop. If you want to prevent changing scrollTop - you should do it inside onScrollTopChanging event - return nonzero code.
Alex (ActiveWidgets)
December 19,
Example:
var obj = new AW.UI.Grid;
obj.setSize(800, 250);
obj.setCellText(function(i, j){return j + "-" + i});
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(1000);
obj.onScrollTopChanging = function(top){
if (top>100) return "not allowed";
}
obj.onScrollTopError = function(error){
alert(error);
}
document.write(obj);
The same convention applies to all other properties - if you return nonzero code from the onSomeThingChanging(value) event - the assignment is cancelled, your error code is passed to the onSomeThingError(code) event, and onSomeThingChanged(value) event does not fire.
Alex (ActiveWidgets)
December 19,
Thanks a lot!, (this sample is great!)
I didn't notice how can "Error" play to get "Changing-event" returned-params and avoid infinite-loops.
Thx
Carlos
December 19,