0

zk.Widget is null but why?

asked 2011-07-25 10:22:22 +0800

ganzgrosserjunge gravatar image ganzgrosserjunge
39

updated 2011-07-25 10:23:18 +0800

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

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-07-26 02:24:14 +0800

ganzgrosserjunge gravatar image ganzgrosserjunge
39

?

link publish delete flag offensive edit

answered 2011-07-28 04:15:03 +0800

PeterKuo gravatar image PeterKuo
481 2

@ganzgrosserjunge
Where did you get the info of using zk.Widget in zk 3.6.4?

It should be valid since zk5.

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: 2011-07-25 10:22:22 +0800

Seen: 312 times

Last updated: Jul 28 '11

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