-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi everybody and congratulation for this beautiful framework.
I need to call a java method in a Javascript ... is that possible??? I try this solution but it seems not to work
<button label="clic" action="onmousedown: send()" />
<script type="text/javascript">
function send(){
sendCommand(5,5);
}
</script>
<zscript>
void sendCommand(int mbox, int com){
//do some stuff
}
</zscript>
Is there anyway the possibility to implement onmousedown/onmouseup on a button?
Please give me an advice or an idea because i'm so frustrated.
Thanks in advice for your time and helps.
You using a controller via the apply attribute or a component subclass via the use attribute?
I need to call a java method in a Javascript ... is that possible???
Why do you need to call a method directly from Javascript? Why not use an event like the MVC smalltalks illustrate?
I need to control robot movements through buttons.
The problem is that button don't support onMouseDown/onMouseUp events ... the only way is to set an action in the relative button and write a script in Javascript.
But method that permit the robot's movement is written in Java and i need to execute calling it in the script ...
Is there another way?
The problem is that button don't support onMouseDown/onMouseUp events
go to the small talks page, click the "next 200" at the bottom, click ZK MVC Made Easy
Hi all,
If you really need to port a onMouseUp/onMouseDown event to server side, here is a sample to do it:
MouseDownButton.java
package samples.component; public class MouseDownButton extends Button { static { addClientEvent(MouseDownButton.class, "onMyEvent", 0); } }
zul:
<zk xmlns:w="client"> <button label="Go" use="samples.component.MouseDownButton"> <attribute w:name="onMouseDown"><![CDATA[ this.fire('onMyEvent'); ]]></attribute> <attribute name="onMyEvent"><![CDATA[ lb.value = "onMouseDown fired!"; ]]></attribute> </button> <label id="lb" /> </zk>
Regards,
Simon
what about calling a javascript method from a java class? and i don't mean simple classic "alert". i have my own .js file and i wanna call/access the methods from inside a java controller.
Asked: 2010-08-29 04:26:17 +0800
Seen: 1,939 times
Last updated: Aug 15 '12