rte.lzx
<canvas width="100%" height="500">
<include href="extensions/rte.lzx"/>
<class name="rte_editor" extends="window" resizable="true" closeable="true">
<simplelayout/>
<event name="ontext"/>
<attribute name="text" type="html"/>
<rte name="myrte" width="${classroot.content.width-this.x}" height="${classroot.content.height-this.y-5}">
<handler name="oneditorready">
this.setText(parent.text);
</handler>
<handler name="ontext" args="txt">
// Keep the text up to date
parent.setAttribute('text', txt);
</handler>
</rte>
<handler name="ontext" args="txt">
//Debug.write("ontext:", txt);
</handler>
<method name="close" args="...ignore">
myrte.destroy();
super.close();
</method>
<dragstate name="drg"/>
<handler name="onmousedown">
this.myrte.bringToFront();
this.drg.apply();
</handler>
<handler name="onmouseup">
this.drg.remove();
</handler>
</class>
<class name="texteditor" extends="text">
<attribute name="editor" value="null
"/>
<method name="retrieveText" args="text">
this.setAttribute('text', text);
</method>
<handler name="onclick">
this.editor = new lz.rte_editor (canvas,{title:'editor', width:600, height:500, resizable:true, closeable:true, text: this.text});
this.textdel = new LzDelegate (this, 'retrieveText');
this.textdel.register(this.editor, 'ontext');
</handler>
</class>
<simplelayout axis="y" spacing="10"/>
<texteditor>When you click on this text, you can edit it.</texteditor>
<texteditor>This is another text object you can edit.</texteditor>
<rte width="620" height="420">
This is an <b>inline</b> rte editor with custom buttons.
<method name="rte_clear" args="ignore">
this.setAttribute ('text', '');
</method>
<method name="rte_bold" args="ignore">
this.setAttribute ('text', this.text = '<b>' + this.text + '</b>');
</method>
<handler name="oneditorready">
this.addButton ({value:'Clear'}, new LzDelegate(this, 'rte_clear'));
this.addButton ({value:'All Bold'}, new LzDelegate(this, 'rte_bold'));
// Set the color
this.setStyle ('rte_buttons', 'backgroundColor', '#f0f0f0');
</handler>
</rte>
</canvas>
Cross References
Includes
Classes