PDA

View Full Version : Using the Debugger


Anne
01-11-2003, 11:24 AM
Hi all

You may have seen the debugger, and wondered about its use. It doesn't take long to figure out that it can be written to as follows:

Debug.write( 'Hello, World!' );

But did you know about its hidden talents? Consider the code below:


<canvas debug="true">
<view name="myView"
width="50" height="50"
bgcolor="red"
x="120" y="45" />
<text name="myTextView"
x="90" y="75">Hello, Laszlo!</text>
</canvas>


You can access elements from within the debugger. Try typing:

canvas.myView

Into the text input field of the debugger while the app is running in the browser. Hit the enter key, or click "Eval". That doesn't do much, but you can see that it recognized the view "myView". Now try getting an attribute of that view:

canvas.myView.x
>>> 120

You don't need to use getAttribute() in the debugger; it assumes that's what you want. You can manipulate views too (now you have to use setAttribute()):

canvas.myView.setAttribute( 'x', 160 )

You can execute arbitrary code too, to explore how the LZX scripting language works:

2 + 2
>>> 4

Have fun!


Antun Karlovac