zscript

From Documentation
Revision as of 10:31, 5 November 2010 by Tomyeh (talk | contribs)

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
     



Last Update : 2010/11/05

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.