Re: Google Maps, Marker does not close
Hello Eric
Thanks for the reply, please refer to this post of mine. Where I've
managed to fix the problem. However I have an couple of questions
about the issue at hand.
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/85674e6db8e97d1a#
On Dec 17, 4:17 pm, Eric Ayers <zun...@google.com> wrote:
> Hello pfdevil,
>
> Set a breakpoint in your MapClickHandler instance with a Java debugger (like
> running in Debug mode in Eclipse) to get a handle on what your code is
> doing. I see one odd thing. Although it isn't necessarily wrong, you're
> creating a new marker every time the handler goes off. You may find that an
> exception is happening inside the handler before you get a chance to remove
> the overlay.
>
> -Eric.
>
>
>
> On Thu, Dec 17, 2009 at 8:50 AM, pfdevil <devilliers...@gmail.com> wrote:
> > Hello
>
> > I have an issue with an marker that does not want to closed when
> > clicked. I copied the code from this tutorial.
>
> >http://gwt.google.com/samples/HelloMaps-1.0.1/HelloMaps.html#Click%20...
>
> > Here is my code:
>
> > public class SimpleMaps implements EntryPoint{
> > private InfoWindow info = null;
> > private Marker newMarker = null;
> > InfoWindowContent infoWindowContent = null;
>
> > /**
> > * This is the entry point method.
> > */
> > public void onModuleLoad() {
> > LatLng cawkrCity = LatLng.newInstance(39.509, -98.434);
> > VerticalPanel verticalPanel = new VerticalPanel();
>
> > verticalPanel.addStyleName("verticalPanel");
>
> > MapWidget map = new MapWidget(cawkrCity, 4);
>
> > HTML htmlWidget = new HTML("<b> Write a message </b>");
>
> > verticalPanel.add(htmlWidget);
>
> > info = map.getInfoWindow();
>
> > infoWindowContent = new InfoWindowContent(verticalPanel);
>
> > map.setUIToDefault();
>
> > map.addStyleName("mapContainer");
>
> > map.setSize("500px", "300px");
>
> > map.addMapClickHandler(new MapClickHandler() {
> > public void onClick(MapClickEvent e) {
> > MapWidget sender = e.getSender();
> > Overlay overlay = e.getOverlay();
> > LatLng point = e.getLatLng();
>
> > newMarker = new Marker(point);
>
> > if (overlay != null && overlay instanceof Marker) {
> > sender.removeOverlay(overlay);
>
> > } else {
> > sender.addOverlay(newMarker);
> > info.open(newMarker, infoWindowContent);
>
> > }
> > }
> > });
>
> > RootPanel.get("mapContainer").add(map);
>
> > }
>
> > }
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubscribe@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> Eric Z. Ayers
> Google Web Toolkit, Atlanta, GA USA
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home