http://widgets.yahoo.net/blog/?cat=2
Evaluate!

In 4.0.3 and later, we’ve changed the debug window’s evaluate field to actually do what it says now: evaluate. Pretty clever (read: about time). So for example, where you used to type:

print( x )

You now type:

x

Think of all the saved keystrokes!

Hidden Commands!

During 4.0, I ended up adding some commands into the debug window for my own nefarious purposes. I just didn’t put it into the /help command. They are:

/mem Reports the memory used by JavaScript itself. Note that this is not the memory used by the application as a whole. It’s generally fairly small.

/gc Forces garbage collection to happen immediately, prints the final memory number. Again, this is the memory used by the JS engine, not by the entire application.

/tracethrow [on|off] Allows you to see what the file and line number is as an exception happens.

Secret Functions!

One of the most useful functions you can use is _dumpViews. You use it as such:

_dumpViews( windowVariable )

You’ll end up with a nicely formatted list of views in the specified window. This is helpful if you don’t understand why things aren’t visible, etc. I use this all the time to help debug engine oddities.

A sample output might look like:

Window 010AEB30 d:0
View (010AEE18): (0 0 100 200) d:0 z:-1 v:1 o:255
Image (01091910): (0 0 140 140) d:0 z:1 v:1 o:255 image001 src: Sun.png
Image (01091AB0): (0 0 140 140) d:0 z:2 v:1 o:255 clipped src: Sun.png

In the output, there’s many abbreviated terms. ‘d’ means dirty, and is used internally for drawing. ‘z’ is the z-order of the view. ‘v’ means visible and should be 0 or 1. ‘o’ is the current opacity from 0 to 255.

That’s all for this time around. Hopefully the above items will help you debug your Widgets more effectively. 

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-1) was last changed on 28-Nov-2007 23:43 by UnknownAuthor