Sorry - if you use gmail, you'll have to open the quoted text (that's where I made the change).
On Thu, Mar 19, 2009 at 10:00 PM, markmac <[email protected]> wrote: > > I think he means the call to createJsFunction() and gwtMethod() which > are both static, BTW, I found this in the GWT Doco: > > > http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideJavaFromJavaScript > > which shows how to avoid the need for static calls... > > I have tried getting this to work, but I see, to have some trouble > calling the window.jsToGWT method, its giving me the error "this > $static is null" you ever seen this? > > On Mar 20, 11:54 am, Ian Bambury <[email protected]> wrote: > > Sorry, I don't understand. What static call? What 'way below'? > > And obviously it won't work if you don't include the GWT app in the page. > > > > Ian > > > > http://examples.roughian.com > > > > 2009/3/20 Vitali Lovich <[email protected]> > > > > > Slight modification - why are you making it a static call? What about > the > > > way below. > > > > > Also, don't forget to include the nocache.js file in your HTML - it > > > actually needs to be there statically (well - inserted onto the page > before > > > it finishes loading). > > > > > On Thu, Mar 19, 2009 at 8:44 PM, Ian Bambury <[email protected]> > wrote: > > > > >> Something like this: > > > > >> package com.whatever.client; > > > > >> public class Main implements EntryPoint > > >> { > > >> public void onModuleLoad() > > >> { > > >> createJsFunction(); > > >> } > > > > >> private native void createJsFunction() > > >> /*-{ > > >> $wnd.jsToGWT = function(parm) > > >> { > > >> th...@com. > > >> whatever.client.Main::gwtMethod(Ljava/lang/String;)(parm); > > >> }; > > >> }-*/; > > > > >> @SuppressWarnings("unused") > > >> protected void gwtMethod(String parm) > > >> { > > >> RootPanel.get().add(new Label(parm)); > > >> } > > >> } > > > > >> and then you can test with this > > > > >> <a href=# onclick="javascript:jsToGWT('Hi!')">Click</a> > > > > >> in the html > > > > >> Ian > > > > >>http://examples.roughian.com > > > > >> 2009/3/20 markmac <[email protected]> > > > > >>> Hi Ian, > > > > >>> That sounds like a good idea, dont know why i didnt think of that... > > >>> nice one! > > > > >>> Im assuming you mean that I need to define a JSNI method in my GWT > > >>> code, that my own custom client code calls to invoke the insertion of > > >>> the widget on to the page? > > > > >>> thanks for the thoughts! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
