Want scrollable log trace or text edit? here's how:
HTML:
<div class="palm-group unlabeled" id="scrollID" x-mojo-element="Scroller">
<div id="scrolling_contents">
</div>
</div>
JS:
SETUP
this.modesModel = {scrollbars: true, mode: "vertical"},
this.controller.setupWidget('scrollID', {}, this.modesModel);
this.scroller = this.controller.get('scrollID');
this.scrollStarting = this.scrollStarting.bind(this);
this.controller.listen(this.scroller, Mojo.Event.scrollStarting, this.scrollStarting);
this.controller.setupWidget('scrollID', {}, this.modesModel);
this.scroller = this.controller.get('scrollID');
this.scrollStarting = this.scrollStarting.bind(this);
this.controller.listen(this.scroller, Mojo.Event.scrollStarting, this.scrollStarting);
MyAssistant.prototype.scrollStarting = function(event) {
event.scroller.addListener(this);
Mojo.Log.info(new Date(), "scroll starting");
}
event.scroller.addListener(this);
Mojo.Log.info(new Date(), "scroll starting");
}
MyAssistant.prototype.AddLog= function(str,bClear)
{
if(bClear==undefined){
if(this.controller.get('scrolling_contents').innerHTML.length>0)
this.controller.get('scrolling_contents').innerHTML+="<br />";
this.controller.get('scrolling_contents').innerHTML+=str;
}
else if(bClear==true)
{
this.controller.get('scrolling_contents').innerHTML=str;
}
}
{
if(bClear==undefined){
if(this.controller.get('scrolling_contents').innerHTML.length>0)
this.controller.get('scrolling_contents').innerHTML+="<br />";
this.controller.get('scrolling_contents').innerHTML+=str;
}
else if(bClear==true)
{
this.controller.get('scrolling_contents').innerHTML=str;
}
}
Magic , Isn't it?
0 comments