I've attached a debugger-window class, which others may find usefull.
It will show a qooxdoo window showing all debug messages. When a new
message arrives it will show up again.

I've attached the file as a .txt file (so you need to rename it to debug.js)

To use edit your html-file, to also load the debug.js library, just
after you loaded qooxdoo.
Like this:

 ...
    <script type="text/javascript" src="../qooxdoo/script/qooxdoo.js"></script>
    <script type="text/javascript" src="debug.js"></script>
 ...

Then to make it appear create the debugger-window and add it to your
application, like this:

  window.application.main = function()
  {
    this.add (new Debugger());
    // the rest of your own code here
  }

You can add it at any time you want, anywhere you want. Before the
debugger is created, the debug messages will be collected. So you can
also choose to add a button to your application that opens up the
debug-window.

Because it collects the data before the Debugger is created you will
have all messages, even from before, the debugger was created!

Hope this helps people out!

Greetings,
Ralf
var debugCollect = new Array();
QxObject.prototype.debug = function(m, c) 
{
    var clz = this.classname;
    var hc = this._hashCode;    
    debugCollect.push(c+":"+clz+"@"+hc+":" + m);
};       

function Debugger ()
{
    QxWindow.call(this, "QooxDoo Debug Messages");  
    this.set({centered: true, top: 100, left: 100, showClose: false, width: 
400, height: 200, minHeight: null, minWidth: null});
    this.debugList = new QxList();
    this.debugList.set({top: 0, left: 0, right: 0, bottom: 0, overflow: 
"scroll"});
    this.add(this.debugList);    
    for (var i=0; i<debugCollect.length; i++)
    { this.debugList.add(new QxListItem(debugCollect[i])); } 
    var o = this;
    QxObject.prototype.debug = function(m, c) {
    var clz = this.classname;
    var hc = this._hashCode;
    o.open();
    setTimeout ( function()  {o.debugList.add (new QxListItem (clz+"@"+hc+":" + 
m + " (" + c + ")")); }, 0 ); };       
}
Debugger.extend (QxWindow, "Debugger");

Reply via email to