Hi Yousef,

In the Maps APIb A click handler on the map gets all clicks, so you
see weird behavior such as:

 - double clicking cause the map gets the events "click", "click",
then "doubleclick"
 - the map event also gets events registered on overlays, so a click
on a marker produces a "click" event on the marker AND a "click" event
on the map.

This is one of the odd things about the Maps API.  I should update the
javadoc to point this out.  If someone knows of a way to turn "off"
this behavior, let me know and I can work on incorporating it.

On Mon, Feb 2, 2009 at 3:13 AM, Yousef.Ghandour
<[email protected]> wrote:
>
> Thanks a lot  :-).
> Ya, it did work. But how you came to this conclusion?
> thanks
> yousef
>
> On Feb 1, 2:21 pm, Eric Ayers <[email protected]> wrote:
>> It appears that your Map click handler is getting fired when you click
>> the maximize button.   I think you can add this test at the top of
>> your click handler before re-invoking the info window to avoid this:
>>
>>   if (overlay instanceof InfoWindow) {
>>     return;
>>   }
>>
>> Let me know if that solves the problem.
>>
>> -Eric.
>>
>> On Sun, Feb 1, 2009 at 3:59 AM, Yousef.Ghandour
>>
>> <[email protected]> wrote:
>>
>> > This will render the infoWindow just fine, and the max is working
>> > also:
>>
>> > private void handleClick(MapClickEvent e) {
>>
>> >                final MapWidget sender = e.getSender();
>>
>> >                final Overlay overlay = e.getOverlay();
>>
>> >                final LatLng point = e.getLatLng();
>>
>> >                final InfoWindowContent content;
>>
>> >                HTML htmlWidget = new HTML(
>>
>> >                                "<h1>ATTENTION PLEASE</h1>"
>>
>> >                                                + "<p> I have a few things 
>> > to say to you (click maximize.)</
>> > p>");
>>
>> >                content = new InfoWindowContent(htmlWidget);
>>
>> >                content.setMaxContent("<p>Now is the time for all good men 
>> > to come
>> > to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>"
>>
>> >                                                + "<p>Now is the time for 
>> > all good men to come to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>");
>>
>> >                content.setMaxTitle("ATTENTION PLEASE");
>>
>> >                infoWindow = sender.getInfoWindow();
>>
>> >                infoWindow.open(sender.getCenter(), content);
>>
>> > }
>>
>> > This will render the infoWindow, but when max btn is clicked, the
>> > window will disappear.
>>
>> > private void handleClick(MapClickEvent e) {
>>
>> >                final MapWidget sender = e.getSender();
>>
>> >                final Overlay overlay = e.getOverlay();
>>
>> >                final LatLng point = e.getLatLng();
>>
>> >                final InfoWindowContent content;
>>
>> >                HTML htmlWidget = new HTML(
>>
>> >                                "<h1>ATTENTION PLEASE</h1>"
>>
>> >                                                + "<p> I have a few things 
>> > to say to you (click maximize.)</
>> > p>");
>>
>> >                content = new InfoWindowContent(htmlWidget);
>>
>> >                content.setMaxContent("<p>Now is the time for all good men 
>> > to come
>> > to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>"
>>
>> >                                                + "<p>Now is the time for 
>> > all good men to come to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>");
>>
>> >                content.setMaxTitle("ATTENTION PLEASE");
>>
>> >                infoWindow = sender.getInfoWindow();
>>
>> >                infoWindow.open(point, content);
>>
>> > }
>>
>> > This will render the window, and will show the max window when the
>> > max btn is clicked
>>
>> > however, it will throw the exception below
>>
>> > private void handleClick(MapClickEvent e) {
>>
>> >                final MapWidget sender = e.getSender();
>>
>> >                final Overlay overlay = e.getOverlay();
>>
>> >                final LatLng point = e.getLatLng();
>>
>> >                final InfoWindowContent content;
>>
>> >                HTML htmlWidget = new HTML(
>>
>> >                                "<h1>ATTENTION PLEASE</h1>"
>>
>> >                                                + "<p> I have a few things 
>> > to say to you (click maximize.)</
>> > p>");
>>
>> >                content = new InfoWindowContent(htmlWidget);
>>
>> >                content.setMaxContent("<p>Now is the time for all good men 
>> > to come
>> > to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>"
>>
>> >                                                + "<p>Now is the time for 
>> > all good men to come to the"
>>
>> >                                                + " aid of their country 
>> > because we hold these truths to be
>> > self"
>>
>> >                                                + " evident, that I have a 
>> > dream, that one day our children and
>> > our"
>>
>> >                                                + " children's children 
>> > will tear down this wall!</p>");
>>
>> >                content.setMaxTitle("ATTENTION PLEASE");
>>
>> >                infoWindow = sender.getInfoWindow();
>>
>> >                LatLng newPoint = LatLng.newInstance(point.getLatitude(),
>> > point.getLongitude());
>>
>> >                infoWindow.open(point, content);
>>
>> > }
>>
>> > [ERROR] Uncaught exception escaped
>>
>> > com.google.gwt.core.client.JavaScriptException: (TypeError): this.lat
>> > is not a function
>>
>> >  fileName: jar:file:/home/yousef/workspace/lib/gwt-maps.jar!/com/
>> > google/gwt/maps/client/geom/LatLng.java
>>
>> >  lineNumber: 113
>>
>> >  stack: ()@jar:file:/home/yousef/workspace/lib/gwt-maps.jar!/com/
>> > google/gwt/maps/client/geom/LatLng.java:113
>>
>> > public void com.google.gwt.maps.client.impl.EventImpl
>> > $OverlayLatLngCallback.callbackWrapper
>> > (com.google.gwt.maps.client.overlay.Overlay,com.google.gwt.maps.client.geom.LatLng)
>> > ([object gwt_nativewrapper_class],null)@:0
>>
>> > ([object Object],undefined,[object Object])@transient source for
>> > com.google.gwt.maps.client.impl.__EventImplImpl:167
>>
>> > apply([object Object],[object Array])@:0
>>
>> > ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:307
>>
>> > ([object Object],1)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:287
>>
>> > l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
>> > (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
>> > 140g/maps2.api/main.js:90
>>
>> > H([object Object],"click",[object Object],undefined,[object Object])
>> > @http://maps.google.com/intl/en_ALL/mapfiles/140g/maps2.api/main.js:
>> > 287
>>
>> > ([object Object])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:608
>>
>> > apply([object Object],[object Array])@:0
>>
>> > ([object Array])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:307
>>
>> > ([object Object],0)@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:287
>>
>> > l([object Array],(function (d) {if (Ej) {d.Ap(c);} else {try {d.Ap
>> > (c);} catch (e) {}}}))@http://maps.google.com/intl/en_ALL/mapfiles/
>> > 140g/maps2.api/main.js:90
>>
>> > H([object Object],"click",[object Object])@http://maps.google.com/intl/
>> > en_ALL/mapfiles/140g/maps2.api/main.js:287
>>
>> > ([object Event],[object HTMLDivElement])@http://maps.google.com/intl/
>> > en_ALL/mapfiles/140g/maps2.api/main.js:1423
>>
>> > call([object Object],[object Event],[object HTMLDivElement])@:0
>>
>> > ([object Event])@http://maps.google.com/intl/en_ALL/mapfiles/140g/
>> > maps2.api/main.js:290
>>
>> > @:0
>>
>> >        at com.google.gwt.maps.client.geom.LatLng$.getLatitude$(Native
>> > Method)
>>
>> >        at com.timevel.client.timebrowser.TimeBrowserInstance.handleClick
>> > (TimeBrowserInstance.java:146)
>>
>> >        at com.timevel.client.timebrowser.TimeBrowserInstance.access$0
>> > (TimeBrowserInstance.java:124)
>>
>> >        at com.timevel.client.timebrowser.TimeBrowserInstance$1.onClick
>> > (TimeBrowserInstance.java:118)
>>
>> >        at com.google.gwt.maps.client.MapWidget$8.callback(MapWidget.java:
>> > 418)
>>
>> >        at com.google.gwt.maps.client.impl.EventImpl$OverlayLatLngCallback
>> > $1.execute(EventImpl.java:193)
>>
>> >        at
>> > com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions
>> > (EventImpl.java:260)
>>
>> >        at
>> > com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions
>> > (EventImpl.java:246)
>>
>> >        at 
>> > com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:
>> > 241)
>>
>> >        at com.google.gwt.maps.client.impl.EventImpl
>> > $OverlayLatLngCallback.callbackWrapper(EventImpl.java:191)
>>
>> > I suspected that there is something with attaching the info window to
>> > the
>>
>> > map, however i don't know why calling;
>>
>> >                LatLng newPoint = LatLng.newInstance(point.getLatitude(),
>> > point.getLongitude());
>>
>> > will allow the window to be rendered?????
>>
>> > I've also used the following, in order to get a point that is attached
>> > to the
>>
>> > map:
>>
>> >        private void handleClick(MapClickEvent e) {
>>
>> >                final MapWidget sender = e.getSender();
>>
>> >                final Overlay overlay = e.getOverlay();
>>
>> >                final
>>
>> ...
>>
>> read more ยป
> >
>



-- 
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

--~--~---------~--~----~------------~-------~--~----~
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