Marker.createPeer() from JSNI

10 views
Skip to first unread message

luigi

unread,
Aug 24, 2009, 12:14:22 PM8/24/09
to Google API Libraries for GWT
Hi all,

I create a Marker with marker=Marker.createPeer(marca); and in the
JSNI i created the marca and i put the events in the JSNI, after i
put map.addOverlay(marker) in the gwt code, and the markers appear in
the map but the
the events doesnt work, the must important is a custom info window
anyone can help, and after gave me this warning
[WARN] Malformed JSNI reference 'addOverlay'; expect subsequent
failures
java.lang.NoSuchFieldError: addOverlay

thanks in advance

Eric Ayers

unread,
Aug 24, 2009, 3:43:44 PM8/24/09
to gwt-goo...@googlegroups.com
It sounds like you are calling 'addOverlay()' on an object that isn't a GMap2
--
Google Code Jam 2009
http://code.google.com/codejam

luigi

unread,
Aug 24, 2009, 6:04:56 PM8/24/09
to Google API Libraries for GWT
Hi, Eric!

Yes it was that, now i dont have the errors but dont show the info
window when i click in the marker

i have this code

public native static void myinfowindows2(JavaScriptObject map,Widget
contenido,Double lat,Double lon,String logo,int width,int height,int
zoom) /*-{
$wnd.map=map;

var icon = new $wnd.GIcon();
icon.image = "images/logos/"+logo;


var zoom=zoom;

if(zoom<13){

width=0;
height=0;


}

var newheight=Math.floor((zoom*height)/19);
var newwidth=Math.floor((zoom*width)/19);




icon.iconSize = new $wnd.GSize(newwidth, newheight);

icon.shadowSize = new $wnd.GSize(newwidth, newheight);

icon.iconAnchor = new $wnd.GPoint(Math.floor(newwidth/2), Math.floor
(newheight/2));

icon.infoWindowAnchor = new $wnd.GPoint(Math.floor(newwidth/2),
Math.floor(newheight/2));

var markerOptions1 = {icon:icon, draggable: false, clickable:true};

var point1 = new $wnd.GLatLng(lat,lon);

var marker = new $wnd.GMarker(point1,markerOptions1);




$wnd.GEvent.addListener(marker,'click',function() {

if(marker.LittleInfoWindowInstance) {
marker.closeLittleInfoWidow();

} else {

marker.openLittleInfoWindow('fdsafdsfasdfas');
}
});


$wnd.GEvent.addListener(marker,'mouseover',function() {
marker.openToolTip('Adicione su empresa!');
});

$wnd.GEvent.addListener(marker,'mouseout',function() {
marker.closeToolTip();
});




map.addOverlay(marker);

//return marker;


}-*/;


the tooltip works fine but the click no, i have other example that
work fine with se same map!

any idea?

thanks in advance



Eric Ayers

unread,
Aug 24, 2009, 6:53:28 PM8/24/09
to gwt-goo...@googlegroups.com
Since this is JSNI code, I suggest you pursue the problem with a
JavaScript debugger such as firebug or inspector.

luigi

unread,
Aug 25, 2009, 3:47:29 PM8/25/09
to Google API Libraries for GWT
solved, it was because the string that i put in the info window it was
too small, and in the mode doesnt show because of the property
minwidth!
thanks
Reply all
Reply to author
Forward
0 new messages