47
rated 0 times
[
49]
[
2]
/ answers: 1 / hits: 34143
/ 15 Years ago, thu, june 11, 2009, 12:00:00
I have a native Javascript method in one of my GWT Java classes, but I'm having trouble calling my Java methods from the native Javascript code. I tried to follow this as closely as I could, but I can't get it to work. I compiled it and ran it in Firefox, and the error console said Error: this.lc is not a function. I tried changing all the methods to public, but that didn't seem to make a difference. What am I doing wrong?
package com.proprintsgear.design_lab.client;
...
public class ValueBox extends HorizontalPanel {
...
private void fireChange() {
...
}
private void increaseValue() {
...
}
private native void addNativeMouseWheelListener(String id) /*-{
function mouseOverHandler(e) {
$wnd.addEventListener(DOMMouseScroll, scrollWheelMove, false);
}
function mouseOutHandler(e) {
$wnd.removeEventListener(DOMMouseScroll, scrollWheelMove, false);
}
function scrollWheelMove(e) {
if ($wnd.event || $wnd.Event) {
if (!e) e = $wnd.event;
if (e.wheelDelta <= 0 || e.detail > 0 ) {
$wnd.alert(DOWN);
} else {
[email protected]_lab.client.ValueBox::increaseValue()();
}
[email protected]_lab.client.ValueBox::fireChange()();
}
}
var box=$doc.getElementById(id);
box.addEventListener(mouseout,mouseOutHandler,false);
box.addEventListener(mouseover,mouseOverHandler,false);
}-*/;
More From » java