dev-console-light.lzx

<!--=======================================================================-->
<!--                                                                       -->
<!-- dev-console-light.lzx                                                 -->
<!--                                                                       -->
<!-- lightweight dev console client                                        -->
<!--                                                                       -->
<!--=======================================================================-->
<canvas width="100%" height="370" proxied="false" debug="true">
  <include href="lz/textlistitem.lzx"/>
  <debug options="ignorelayout" fontsize="12" x="73" y="100" width="800" height="270"/>
  <!-- flashvar named 'appinfo' will be supplied, it is XML data -->

  <resource name="footer_logo" src="../assets/logo_laszlo_footer.gif"/>

  <view name="main" layout="axis:x;spacing:6" width="${parent.width}">
      <view name="logo" resource="footer_logo"/>
      <view name="controls" layout="axis:y; spacing:4">
        
        <view name="topspace" height="6"/>
        <view name="params" layout="axis:x">
          <view width="50" name="spacer"/>
        </view>

        <view layout="axis:x;spacing:4">
          <!-- enter expression to be sent to app under debug -->
          <text resize="true" text="Evaluate in remote app"/>
          <edittext doesenter="true" id="expr2" width="300">
            <method name="doEnterDown">
              canvas.remoteEval(expr2.text);
            </method>
          </edittext>
          <button enabled="false" bgcolor="white" id="app_eval_btn" onclick="canvas.remoteEval(expr2.text)">Eval</button>
          <button onclick="app_eval_btn.setAttribute('enabled', true);                            canvas.initConnection();                            canvas.sendConsoleAlive()">Connect To App</button>
        </view>


      </view>
  </view>

  <script>
    receivingLC = new LocalConnection();
  </script>

  <method name="initConnection">
    
    receivingLC = new LocalConnection();
    // receives debugger XML response
    // <response seq="6">
    //    <value id="4" value="This is the canvas" type="LzCanvas">
    //    <property value="[type Function]" type="Function" name="__LZmakeDatapath" />
    receivingLC.debugResult = function(doc) 
    { 
        var response = doc.firstChild;
        Debug.write(doc);
        if (response != null) {
            if (response.nodeName == "response") {
                for (var n = 0; n < response.childNodes.length; n++) {
                    var child = response.childNodes[n];
                    if (child.nodeName == 'value') {
                        var val = child.attributes['value'];
                        var valtype = child.attributes['type'];
                        Debug.write(val, valtype);
                        if (child.hasChildNodes()) {
                            var nnodes = child.childNodes.length;
                            for (var i = 0; i < nnodes; i++) {
                                var param = child.childNodes[i];
                                Debug.write(param.attributes['name'],': ',  param.attributes['value'],
                                            param.attributes['type']);
                            }
                        }
                    } else if (child.nodeName == "warning") {
                        //<warning msg="undefined object does not have a property &apos;bar&apos;"
                        //  line="6" filename="test1.lzx" /> 
                        canvas.showWarning(child);
                    } else if (child.nodeName == "log") {
                        canvas.showLogMessage(child);
                    }
                }
            } else if (response.nodeName == "warning") {
                canvas.showWarning(response);
            } else if (response.nodeName == "log") {
                canvas.showLogMessage(response);
            } else {
                Debug.write(doc);
            }
        }
    }
    
    Debug.write("listening on lc_consoledebug");
    receivingLC.connect("lc_consoledebug");

    var sendingLC = new LocalConnection();

    // sequence numbers for eval requests
    canvas.evalseqnum = 0;
    
    
  </method>

  <method name="showLogMessage" args="response">
       var msg = response.attributes.msg;                
       var item = new _root.LzMessage(msg);
       Debug.addText(item);
       Debug.addText("\n");
  </method>


  <method name="showWarning" args="response">
       var filename = response.attributes.filename;
       var lineNumber = response.attributes.line;
       var msg = response.attributes.msg;                
       var warning = new _root.LzWarning(filename, lineNumber, msg);
       Debug.addText(warning);
       Debug.addText("\n");
  </method>

  <method name="sendConsoleAlive">
                    
      receivingLC.send("lc_appdebug", "consoleAlive", true);
    
  </method>

  <method name="remoteEval" args="expr">
    
    var seqnum = this.evalseqnum++;
    var myXML = new XML();
    var exec = myXML.createElement("exec"); 
    myXML.appendChild(exec);
    exec.attributes.seq = seqnum;
    var content = myXML.createTextNode(expr);
    exec.appendChild(content);

    receivingLC.send("lc_appdebug", "evalExpr", myXML);
    
  </method>


</canvas>
<!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
* Copyright 2001-2011 Laszlo Systems, Inc.  All Rights Reserved.              *
* Use is subject to license terms.                                            *
* X_LZ_COPYRIGHT_END ****************************************************** -->
<!-- @LZX_VERSION@                                                         -->

Cross References

Includes

Resources

Name Source Image
footer_logo ../assets/logo_laszlo_footer.gif

Named Instances