You can make MouseHandler call a callback function which calls a JSNI bridge function. Or you implement the MouseHandler in Java and register it with the map via JSNI.
Check out the overlay type pattern for JSOs. http://googlewebtoolkit.blogspot.com/2008/08/getting-to-really-know-gwt-part-2.html On Sep 5, 10:02 am, Dirtybit <[EMAIL PROTECTED]> wrote: > Hi all, > > what I'm trying to do is populate two textboxes with information from > microsoft VEMap which I have embeded in my html file. > To be more specific I want to show the latitude and longitude of the > point I click on. > > The html file looks like this : > <html> > <head> > ................. > <script language='javascript' > src='gr.urbantech.geopoints.Application.nocache.js'></script> > > <script type="text/javascript" src="http:// > dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></script> > > <script type="text/javascript"> > var map = null; > > function GetMap() > { > map = new VEMap('myMap' ); > map.LoadMap(new VELatLong(41.11, 25.37 ), > 8 ,'r' ,false); > > map.AttachEvent("onmousedown",MouseHandler); > } > function MouseHandler(e) > { > if (e!=null) > { > if (e.rightMouseButton) > { > var x = e.mapX; > var y = e.mapY; > var ll = map.PixelToLatLong(new > VEPixel(x,y)); > var lat=ll.Latitude; (it is a float value) > var long=ll.Longitude; (it is a float value) > alert(ll); > } > } > } > > </script> > </head> > <body> > .............. > <!-- OPTIONAL: include this if you want history support --> > <iframe src="javascript:''" id="__gwt_historyFrame" > style="width:0;height:0;border:0"></iframe> > > .................... > > <table align=center> > <tr> > <td id="slot1"></td> > </tr> > </table> > <!-- > <div id='myMap' style="position:relative; width:600px; height: > 600px;"></div> > --> > > </body> > </html> > > And then onModuleLoad: > public void onModuleLoad() { > > RootPanel slot = RootPanel.get("slot1"); > HorizontalPanel hp =new HorizontalPanel(); > VerticalPanel vp=new VerticalPanel(); > > String html = "<div id='myMap' style='position:relative; width: > 500px; height:500px;'><//div>"; > > mapHtml = new HTML(html); > > vp.add(mapHtml); > > hp.add(vp); > > //hp.add(mapPanel); > slot.add(hp); > callBrowserScript(); > > } > > public static native void callBrowserScript() /*-{ > $wnd.GetMap(); > }-*/; > > How can I pass the lat and long variables to gwt so as to be able to > fill my textboxes? > I have read the jsni documentation but was able to do only the > opposite thing which is to center the map to the coordinates I put in > the textboxes. > That is i can pass info from gwt to js but no the other way round. > > Thanks in advance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
