[Laszlo-checkins] r11995 - in openlaszlo/trunk/docs/src/developers/tutorials: . programs
lou@openlaszlo.org
lou at openlaszlo.org
Sat Dec 6 09:52:44 PST 2008
Author: lou
Date: 2008-12-06 09:51:51 -0800 (Sat, 06 Dec 2008)
New Revision: 11995
Modified:
openlaszlo/trunk/docs/src/developers/tutorials/data.dbk
openlaszlo/trunk/docs/src/developers/tutorials/programs/classes-tutorial-$5.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/data-tutorial-$6.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$1.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$2.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$3.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$7.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$14.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$15.lzx
openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$16.lzx
openlaszlo/trunk/docs/src/developers/tutorials/scripting.dbk
Log:
Change 20081206-lou-S by lou at loumac.local on 2008-12-06 13:40:32 AST
in /Users/lou/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: dguide, tutorials: emphasize Debug.debug over Debug.write in examples
Bugs Fixed: LPP-7437 (partial)
Technical Reviewer: tucker
QA Reviewer: (pending)
Doc Reviewer: (pending)
Details:
Change some examples that used the debugger to use text instead.
Change remaining examples using Debug.write() to use Debug.debug.
Tests: visual verify
Modified: openlaszlo/trunk/docs/src/developers/tutorials/data.dbk
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/data.dbk 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/data.dbk 2008-12-06 17:51:51 UTC (rev 11995)
@@ -147,7 +147,7 @@
</example>
- <para>For brevity's sake, we are writing to the debugger, and we are including the data from a local file. You can download that XML file <ulink url="http://labs.openlaszlo.org/trunk-nightly/docs/developers/programs/resources/myShowData.xml">here</ulink>, and here's what it looks like:</para>
+ <para>We are including the data from a local file. You can download that XML file <ulink url="http://labs.openlaszlo.org/trunk-nightly/docs/developers/programs/resources/myShowData.xml">here</ulink>, and here's what it looks like:</para>
<programlisting>
<myXML>
<person show="simpsons">
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/classes-tutorial-$5.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/classes-tutorial-$5.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/classes-tutorial-$5.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,42 +1,35 @@
-
-<canvas width="100%" height="300" debug="true">
- <debug x="175"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<canvas width="100%" height="180">
<resource name="standardButton">
<frame src="resources/button_blue.gif"/>
<frame src="resources/button_green.gif"/>
</resource>
-
+
<resource name="specialButton">
<frame src="resources/button_red.gif"/>
<frame src="resources/button_green.gif"/>
</resource>
-
- <class name="MyButton" resource="standardButton"
- onclick="doAction()" onmouseover="doOver()" onmouseout="doOut()">
- <method name="doAction">
- Debug.write('Dog');
- </method>
- <method name="doOver">
- this.setAttribute('frame', 2);
- </method>
- <method name="doOut">
- this.setAttribute('frame', 1);
- </method>
+
+ <class name="MyButton" resource="standardButton" onclick="doAction()" onmouseover="doOver()"
+ onmouseout="doOut()">
+ <method name="doAction"> pet.addText("dog "); </method>
+ <method name="doOver"> this.setAttribute('frame', 2); </method>
+ <method name="doOut"> this.setAttribute('frame', 1); </method>
</class>
-
+
<class name="MySpecialButton" extends="MyButton" resource="specialButton">
- <method name="doAction">
- Debug.write('Monday');
- </method>
+ <method name="doAction"> weekday.addText("Monday "); </method>
</class>
-
- <view name="buttons" x="125" y="5">
+
+ <view name="buttons" x="5" y="5">
<simplelayout axis="y" spacing="10"/>
<MyButton/>
+ <text id="pet"/>
<MySpecialButton/>
+ <text id="weekday"/>
</view>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2008 Laszlo Systems, Inc. All Rights Reserved. *
-* Use is subject to license terms. *
-* X_LZ_COPYRIGHT_END ****************************************************** -->
+ * Copyright 2008 Laszlo Systems, Inc. All Rights Reserved. *
+ * Use is subject to license terms. *
+ * X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/data-tutorial-$6.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/data-tutorial-$6.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/data-tutorial-$6.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,13 +1,12 @@
-
-<canvas height="180" width="100%" debug="true">
+<canvas height="50" width="100%">
+ <text id="sometext" />
<dataset name="myData" src="resources/myShowData.xml" />
<datapointer xpath="myData:/myXML" ondata="processData()">
<method name="processData">
this.selectChild();
do {
if (this.xpathQuery( '@show' ) == 'south park') {
- Debug.write(this.xpathQuery('firstName/text()'));
- }
+ sometext.addText(this.xpathQuery('firstName/text()') + "\n"); }
} while (this.selectNext());
</method>
</datapointer>
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$1.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$1.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$1.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,10 +1,11 @@
-
-<canvas width="100%" height="200" debug="true">
+<canvas width="100%" height="50">
+ <text id="sometext" />
<script>
- Debug.write("Hello, World!");
+ sometext.setAttribute("text", "hello world");
</script>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
-* Use is subject to license terms. *
-* X_LZ_COPYRIGHT_END ****************************************************** -->
+ * Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
+ * Use is subject to license terms. *
+ * X_LZ_COPYRIGHT_END ****************************************************** -->
+
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$2.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$2.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$2.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,15 +1,15 @@
-
-<canvas width="100%" height="200" debug="true">
+<canvas width="100%" height="100">
+ <simplelayout axis="y" spacing="5" />
+ <text id="sometext" />
+ <text id="moretext" />
<script>
- // some random scripting
- //
- var someStr = "Hello, World!";
- Debug.write(someStr);
+ var somestring = "Hello, World!";
+ sometext.addText(somestring);
var first = 4;
var second = 3;
var result = first + second;
- Debug.write(result);
- </script>
+ moretext.addText(result);
+ </script>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$3.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$3.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$3.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,22 +1,18 @@
-
-<canvas width="100%" height="200" debug="true">
+<canvas width="100%" height="100">
+ <simplelayout axis="y" spacing="5" />
+ <text id="sometext" />
+ <text id="badtext" />
+ <text id="goodtext" />
<script>
- // some random scripting
- //
- var someStr = "Hello, World!";
- Debug.write(someStr);
var first = 4;
var second = 3;
var result = first + second;
- Debug.write(result);
- Debug.write(first + " plus " + second + " is " + first + second);
- var two = 2;
- if (2 == two) {
- Debug.write("2 is two");
- }
+ sometext.setAttribute("text", result);
+ badtext.setAttribute("text", first + " plus " + second + " is " + first + second);
+ goodtext.setAttribute("text", first + " plus " + second + " is " + (first + second));
</script>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$7.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$7.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/scripting-tutorial-$7.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,18 +1,15 @@
-
-<canvas height="200" width="100%" debug="true">
+<canvas height="100" width="100%">
+ <text id="sometext" />
<script>
<![CDATA[
- // write a word to the debugger
- //
- function writeAWord(someWord) {
- Debug.write(someWord);
+ function writeAWord(someword) {
+ sometext.setAttribute("text", someword);
}
-
writeAWord("HELLO!");
]]>
</script>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$14.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$14.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$14.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,8 +1,8 @@
-<canvas height="135" width="100%" debug="true">
+<canvas height="200" width="100%" debug="true">
<debug x="200"/>
<button x="15" y="15"
- onclick="Debug.write(canvas.theField.getText());">
+ onclick="Debug.debug('%s', canvas.theField.getText());">
Get Text
</button>
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$15.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$15.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$15.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,12 +1,12 @@
-<canvas height="135" width="100%" debug="true">
+<canvas height="200" width="100%" debug="true">
<debug x="200"/>
<font name="sansSerifFont" src="helmetr.ttf" />
<script>
function writeOutBit() {
var myText = canvas.theField.getText();
- Debug.write(myText);
+ Debug.debug("%s", myText);
}
</script>
Modified: openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$16.lzx
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$16.lzx 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/programs/text-tutorial-$16.lzx 2008-12-06 17:51:51 UTC (rev 11995)
@@ -1,13 +1,12 @@
-<canvas height="135" width="100%" debug="true">
- <debug x="200"/>
+<canvas height="200" width="100%" debug="true">
<inputtext name="myText" x="10" y="15">Enter text here</inputtext>
<button x="45" y="45"
- onclick="Debug.write(canvas.myText.getText());">
+ onclick="Debug.debug('%s', canvas.myText.getText());">
Write out text
</button>
</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2007, 2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ****************************************************** -->
Modified: openlaszlo/trunk/docs/src/developers/tutorials/scripting.dbk
===================================================================
--- openlaszlo/trunk/docs/src/developers/tutorials/scripting.dbk 2008-12-06 17:50:07 UTC (rev 11994)
+++ openlaszlo/trunk/docs/src/developers/tutorials/scripting.dbk 2008-12-06 17:51:51 UTC (rev 11995)
@@ -24,13 +24,9 @@
<indexterm><primary>canvas</primary></indexterm><sgmltag class="element"><canvas></sgmltag><remark role="fixme">[unknown tag]</remark>
<!--unknown tag: canvas-->
. </para>
-<note><para>
- In the program below, note the <literal>debug="true"</literal>
-attribute, which opens up the OpenLaszlo Debugger. In these tutorials we will use the debugger as a scratchpad to illustrate
-scripting concepts.</para></note>
<example role="live-example">
- <title>Using the debugger</title>
+ <title>Using the <literal><script></literal> tag</title>
<programlisting language="lzx">
<textobject><textdata fileref="programs/scripting-tutorial-$1.lzx"/></textobject>
</programlisting>
@@ -56,9 +52,9 @@
</programlisting>
</example>
-<para>Everything there is fine, except the "<literal>4 plus 3 is …</literal>" line. Four plus three should be 7, as in
-the line immediately above it, right? What happened is that we concatenated numbers to strings
-earlier on (<literal>4 + " plus " + 3</literal>), and that operation converted the numbers to strings.</para>
+ <para>Everything there is fine, except the "<literal>badtext.setAttribute( … );</literal>" line. Four plus three should be 7, as in
+the line immediately above it, right? What happened is that we concatenated numbers to strings
+(<literal>(..." is " + first + second)</literal>). The next line shows one way to fix this problem.</para>
<para>
OpenLaszlo documentation is not intended to provide a complete reference for JavaScript. Later chapters do explain some
advanced topics in scripting, but we recommend that you have a JavaScript reference handy while writing LZX.
@@ -72,7 +68,7 @@
<-- the following code will not compile because of the angle bracket -->
<script>
for (var i = 0; i < 11; i++) {
- Debug.write(i);
+ Debug.debug("%d", i);
}
</script>
</canvas>
@@ -91,7 +87,7 @@
<canvas height="120">
<script>
for (var i = 0; i <emphasis role="em">&lt;</emphasis> 11; i++) {
- Debug.write(i);
+ Debug.debug("%d", i);
}
</script>
</canvas>
@@ -102,7 +98,7 @@
<script>
<emphasis role="em"><![CDATA[</emphasis>
for (var i = 0; i < 11; i++) {
- Debug.write(i);
+ Debug.debug("%d", i);
}
<emphasis role="em">]]></emphasis>
</script>
More information about the Laszlo-checkins
mailing list