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%20Handling

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 [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.


Reply via email to