-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello!
I am using zk 3.6.4
I need to know the absolut positions (x,y) of includes and boxes on clientside. Therefore I tried to find out how to communicate between javascript and zk and found some examples.
First example I found dealt with zAu.send.
This did not work for me. I think because of my zk version.
However, I tried zkau.send. But this fails with a nullpointer exception in javascript. zk.Widget is null or no object when clicking on the "click me" link.
Can anybody tell me, what is going wrong?
It would be great if anybody could post a working example (only zul) for zk 3.6.4.
Here is my code:
<zk>
<window onClientInfo="onClientInfo(event)" id="mainWin"
border="0"
height="100%" position="center"
width="100%">
<textbox id="tb"/>
<textbox id="ta"/>
<include id="headerContainer" height="100px"/>
<vbox align="center" height="100px" width="100%" id="contentContainer"/>
<include id="inc" height="100px"/>
<zscript>
void onClientInfo(ClientInfoEvent evt) {
tb.setText(evt.getDesktopHeight().toString() +
", " + evt.getDesktopWidth().toString());
ta.setText(contentContainer.getHeight());
}
</zscript>
<html><![CDATA[
<script type="text/javascript">
function callJavaMethod(){
var comp = $e(zk.Widget.$(this));
zkau.send({uuid:comp.uuid, cmd: "onGetFlashTime", data: obj.position, ignorable: true},
zkau.asapTimeout(comp, "onGetFlashTime", 10));
}
</script>
<a href="#" onClick="callJavaMethod();">Click me</a> ]]>
</html>
</window>
</zk>
Thank you in advance!
Michael
?
Asked: 2011-07-25 10:22:22 +0800
Seen: 312 times
Last updated: Jul 28 '11