2008/10/13 freeall <[EMAIL PROTECTED]>
>
> Hi.
>
> Thanks. I made static calls work, but I can't make it work on
> instances.
>
> Sorry for all the text below. The only question is on the last. Just
> wanted to make sure that all details was here.
>
> So imagine this webpage layout, split into different panels:
>
> ---------------------
> | 1 | 2 |
> | | |
> | | |
> | | |
> ---------------------
> This is done as a GWT app, FooGUI(.java) in package dk.cfph.client.
>
> In 1. I have a menu. When clicking on one of these items it loads some
> html+javascript into panel 2 [put inside a Frame widget]. This html
> +javascript is generated on the webserver that the GWT has contact
> with.
> I would like this javascript to be able to contact the GWT
> application.
>
> So what I have now is this:
> In FooGUI I have these methods:
> void tmpcall() {
> Window.alert("Hello world!42foobar we got hole!!!! this='" + this +
> "'");
> }
> static void tmpcallstatic() {
> Window.alert("in tmpcallstatic!");
> }
> public native void tmpexpose() /*-{
> $doc.exposedfunction = function() {
> $wnd.alert('in tmpexpose()');
> @dk.cfph.client.FooGUI::tmpcallstatic()();
> [EMAIL PROTECTED]::tmpcall()();
> $wnd.alert('end of tmpexpose()');
> }
> }-*/;
inside the javascript function this is undefinded.
if you use it outside the function it will work. so use a variable to fix
this.
>
>
> In the constructor I have this call: tmpexpose();
>
> In the HTML which is put into the Frame on 2., I have this: ...<p
> onclick="alert(\foo');exposedfunction()">click here</p>
>
> When I click on it, I get these alerts:
> 'foo'
> 'in tmpexpose()' [meaning that we got contact to the native method]
> 'in tmpcallstatic!' [meaning that we got contact to the static java
> method]
>
> Then it stops. So this means that [EMAIL PROTECTED] did not work.
> How can this be? I can sort of understand that "this." does not work.
> But then again, I think it should :)
> Any help?
>
> /Tobias
>
> On Oct 10, 8:17 am, "Daniel Kurka" <[EMAIL PROTECTED]>
> wrote:
> > Im doing the exakt same thing
> > Here is what you need to do:
> >
> > 1. have you gwt app expose a function as javascript e.g.:
> >
> > private native void expose()
> > {
> > $doc.exposedfunction = function()
> > {
> > [EMAIL PROTECTED]::functionname()();
> >
> > }
> > }
> >
> > 2. Have the code inside the frame call this javascript function and you
> are
> > done
> >
> > you might want to take a look into the JSNI interface there
> >
> > 2008/10/9 freeall <[EMAIL PROTECTED]>
> >
> >
> >
> > > Hi.
> >
> > > I am loading some javascript+html into a Frame widget. I would like
> > > this code to perform a callback to the GWT application. Right now I am
> > > trying to do an AJAX call to
> > >http://myserver:8080/SomeGWTPage.html#docallback?foo,
> > > but this just loads the SomeGWTPage.html and returns the result.
> >
> > > I think I understand why this happens. The code in the Frame widget
> > > don't send the callback to the browser, but creates a new connection
> > > to myserver:8080. So GWT will never be called.
> >
> > > Is there any way to perform this callback to the GWT application?
> >
> > > /Tobias
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---