0

Mixed language, methods not found

asked 2010-06-29 12:01:30 +0800

eptx gravatar image eptx
130 3

I'm re-posting this because of its severity. Specifically, the interpreter is not finding zscript methods in a mixed language (java/groovy) approach. Not sure if this is a bug or if I'm misunderstanding of zk. Has anyone successfully used java and groovy zscript in the same page?
Thanks!

Error:
No signature of method: Script5.doOk() is applicable for argument types: () values: []
Possible solutions: dump(), wait(), run(), run(), any(), wait(long)

Code...
<?page zscriptLanguage="Groovy"?>
<zk>
<zscript language="java">

void doOk() {
Messagebox.show("ENTER key is pressed", "OK", Messagebox.OK, Messagebox.EXCLAMATION);
inp.focus();
}

</zscript>
<zscript language="Groovy">
def doCtrlKey() {
Messagebox.show(event.getKeyCode()+" is pressed", "CtrlKey", Messagebox.OK, Messagebox.EXCLAMATION)
inp.focus()
}

</zscript>
<panel id="panel" title="CMIS Web, ZK"
border="normal" sclass="p-vista">

<toolbar id="tb" sclass="vista" height="20px" align="end">
<toolbarbutton image="/img/volumn.gif"
onClick='alert("Volumn")' />
<toolbarbutton label="12:55 PM"
onClick='alert("time")' />
</toolbar>
<panelchildren>
<hbox>
<tabbox >
<tabs>
<tab label="Tab 1" closable="true"/>
<tab label="Tab 2" closable="true"/>
<tab label="Tab 3" closable="true"/>
<tab label="Tab 4" closable="true"/>
<tab label="Tab 5" closable="true"/>
</tabs>

<tabpanels>
<tabpanel>
<vbox>
<grid fixedLayout="true" width="400px">
<rows>
<row>
Password
<textbox id="inp" onOK="doOk()" onCancel="doCancel()" ctrlKeys="^a^b#f2" onCtrlKey="doCtrlKey()" type="password" value="123456789" width="150px" />
</row>
</rows>
</grid>
</vbox>
</tabpanel>
</tabpanels>
</tabbox>
</hbox>
</panelchildren>
</panel>

<zscript language="java">
{
void doCancel() {
Messagebox.show("ESC key is pressed", "CANCEL", Messagebox.OK, Messagebox.EXCLAMATION);
inp.focus();
}
}
</zscript>

</zk>

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-06-30 20:20:43 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi eptx
What version of ZK are you using?

link publish delete flag offensive edit

answered 2010-07-14 11:57:01 +0800

eptx gravatar image eptx
130 3

5.02

link publish delete flag offensive edit

answered 2010-07-17 11:48:44 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

I have created a sample

<?page zscriptLanguage="Groovy"?>
<zk>
	<zscript language="java">
		void doOk() {
			Messagebox.show("ENTER key is pressed", "OK", Messagebox.OK, Messagebox.EXCLAMATION);
			inp.focus();
		}
	</zscript>
	<zscript language="Groovy">
		doCtrlKey = {
			Messagebox.show(event.getKeyCode()+" is pressed", "CtrlKey", Messagebox.OK, Messagebox.EXCLAMATION)
			inp.focus()
		}
	</zscript>
	<zscript language="java">
		{
			void doCancel() {
				Messagebox.show("ESC key is pressed", "CANCEL", Messagebox.OK, Messagebox.EXCLAMATION);
				inp.focus();
			}
		}
	</zscript>
	<textbox id="inp" onOK="java:doOk()" onCancel="java:doCancel()" ctrlKeys="^a^b#f2" onCtrlKey="doCtrlKey()" type="password" value="123456789" width="150px" />
</zk>



your default language is Groovy
so you shall specify language when call the java method
and the method of Groovy, you shall declare like my sample

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-06-29 12:01:30 +0800

Seen: 357 times

Last updated: Jul 17 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More