zscript
From Documentation
The default interpreter for the zscript elements is Java (based on BeanShell). Depending on your preference, you could choose one of built-in interpreters, or implement your own interpreter.
The built-in interpreters includes: Java, Groovy, Ruby, Python, and JavaScript.
Choose Interpreter for Whole Page
To change the default interpreter for the whole page, you could use the page directive by specifying the zscriptLanguage attribute, such as
<?page zscriptLanguage="Groovy"?>
<window border="normal">
<vbox id="vb">
<label id="l" value="Hi"/>
<button label="change label" onClick="l.value='Hi, Groovy';"/>
<button label="add label" onClick="new Label('New').setParent(vb);"/>
</vbox>
<button label="alert" onClick="alert('Hi, Groovy')"/>
</window>
Choose Interpreter for zscript
You could choose an interpreter for a particular zscript element by specifying the language attribute as follows.
<zscript language="Ruby">
(Java::Label.new 'New').parent = $vb
</zscript>
Choose Interpreter for Event Handler
You could choose an interpreter for a particular event handler by prefixing it with the language name as follows.
<button label="alert" onClick="python:alert('Hi, Python')"/>
Version History
Last Update : 2010/11/5
Version | Date | Content |
---|---|---|