<para>Examples of expressions are <literal>canvas.x</literal>,
<literal>1+2</literal>, and
+ <literal>lz.Browser.LoadURL('http://www.laszlosystems.com/',
'_blank')</literal>.
lz.Browser.LoadURL(...) => lz.Browser.loadURL(...)
[lower-case "l" in "loadURL"]
'http://www.laszlosystems.com/' => 'http://www.openlaszlo.org/'
[The openlaszlo.org domain is preferred over laszlosystems.com, see
LPP-3674, LPP-954, LPP-953, LPP-211, etc.]
+ print the expression value in the debugger log.) An example
of a non-expression statements
+ is <literal>for (int i = 0; i < 10; i++) Debug.debug("%d",
i)</literal>. This is
for (int i = 0; i < 10; i++) Debug.debug("%d", i) => for (var i = 0;
i < 10; i++) Debug.debug("%d", i)
["var" instead of "int"]
+ <para>The debugger can be used to define global variables. Use the
<literal>var</literal>
+ keyword to define a new global variable. For example, after
evaluating <literal>var
+ n=100</literal>, evaluating <literal>n+1</literal> will print
the value
+ <literal>101</literal>.</para>
+
+ <note>
+ <para>The <literal>var</literal> keyword is only necessary to define
<emphasis role="em"
+ >new</emphasis> global variables. You do not need it to change the
value of existing
+ variables. For example, after evaluating <literal>var
n=100</literal>, you can evaluate
+ <literal>n=200</literal> to change the value of
<varname>n</varname>. You do not need to
+ evaluate <literal>var n=200</literal> (although the extra
<literal>var</literal> is
+ harmless.)</para>
+ </note>
+
+ <para>You can also use <literal>var</literal> to create new global
functions. <literal>var f =
+ function (x) {return x+1}</literal> creates a new function
named <varname>f</varname>,
+ which can be used in subsequent expressions such as
<literal>f(1)</literal>.</para>
Global variables won't be created for swf9 or later. We also actually
want to change this behaviour (LPP-8520). Therefore I'd propose to
comment out all three paragraphs for now. The next section "Functions
and Expressions" needs to be updated for swf9+ reality as well. Tucker
should comment on this topic...
+ <note>
+ <para>The <literal><canvas compileroptions= "..."</literal>
ensures that
+ backtraces are on for this example. This option is only
available in OpenLaszlo
+ revisions 4.2.1 and later. Backtraces can also be
enabled in the Developer Toolbar,
+ which is what you would normally do. In general, you
would not deploy an application
+ with backtraces on as they impact the performance of
the application significantly.
+ Backtraces are currently only available in SWF8 and
DHTML runtimes.</para>
+ </note>
"backtrace" doesn't work for swf9+? Is that right Tucker?
On 2/11/2011 3:49 PM, Lou Iorio wrote:
Change lou-20110211-KwB by [email protected] on 2011-02-11 10:39:14 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Debugger tricks need to be documented somewhere
Bugs Fixed: LPP-9661
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details:
preliminary checkin: some debugger changes are expected; doc will
be updated as they happen.
Chapter 51. Debugging
complete rewrite and reorg
Chapter 43. Performance Monitoring and Tuning
developer console --> Developer Toolbar
new screen shot
Chapter 15. Program Structure
developer console --> Developer Toolbar
Chapter 4. Overview of OpenLaszlo Application Development
developer console --> Developer Toolbar
Tests: visual verify, test links
Files:
M docs/src/developers/performance.dbk
M docs/src/developers/debugging.dbk
M docs/src/developers/program-development.dbk
A docs/src/developers/images/debugconsole.png
A docs/src/developers/images/debugcontextmenu.png
D docs/src/developers/images/debug-query-parameter.png
D docs/src/developers/images/debugger-new-console.png
D docs/src/developers/images/debugger.png
D docs/src/developers/images/debug-button.png
M docs/src/developers/images/devtoolbar.png
M docs/src/developers/programs/debuginfo.lzx
M docs/src/developers/structure.dbk
Changeset:
http://svn.openlaszlo.org/openlaszlo/patches/lou-20110211-KwB.tar