Thanks Adam, that was exactly the problem. Now it works fine.
On 31 Mai, 15:38, Adam T <adam.t...@gmail.com> wrote:
> Hi Paul,
>
> You most likely want to write your JSNI call to the external
> Javascript function using the $wnd scope, i.e.
>
> public static native void initGoogleMaps() /*-{
> $wnd.initializeGoogleMaps();
>
> }-*/;
>
> //Adam
>
> On 30 Maj, 20:10, Paul van Hoven <paul.van.ho...@googlemail.com>
> wrote:
>
> > I need some javascript in my page that can't be done by GWT.
> > Therefore, i wrote some javascript and stored it in a js file. I
> > tested the javascript code and it works. Then, i wanted to integrate
> > the javascript into my gwt widget by using JSNI. I did this in the
> > following way:
>
> > JSNI method in my gwt code SearchMobileWidget:
>
> > public static native void initGoogleMaps() /*-{
> > initializeGoogleMaps();
>
> > }-*/;
>
> > my module xml file mobile.gwt.xml (extract):
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//
> > EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-
> > source/core/src/gwt-module.dtd">
> > <module rename-to='mobile'>
> > ...
> > <entry-point class='parken.client.Mobile'/>
>
> > <script src="http://maps.google.com/maps?
> > gwt=1&file=api&v=2&key=ABQIAAAAX2sz-2-
> > uXPNa8l3S5mcKSRRDqbgtXTigyAF4pAvrYpB7OU5BT0XF2EUW5rzHwW_BCpDPh_kGpecQ"/
>
> > <script src="googlemaps.js"/>
> > </module>
>
> > my javascript function "initializeGoogleMaps()" in the js file:
>
> > function initializeGoogleMaps() {
> > if (GBrowserIsCompatible()) {
> > map = new GMap2( document.getElementById(
> > "GoogleMapsDiv" ) );
> > //....and so on...
> > }
> > }
>
> > Remark: If you are wondering why i don't use maps for gwt i must tell
> > you that it does not work in my special case for what reason ever. But
> > using google maps in the normal way with javascript it works fine.
>
> > Okay, back to my problem. When i now run the gwt hosted mode browser i
> > get the following error message in the console:
>
> > [ERROR] Unable to load module entry point class parken.client.Mobile
> > (see associated exception for details)
> > com.google.gwt.core.client.JavaScriptException: (ReferenceError):
> > Can't find variable: initializeGoogleMaps
> > ...
> > at parken.client.mobile.SearchMobileWidget.initGoogleMaps(Native
> > Method)
>
> > Does anybody know what i made wrong or a guess?
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---