Okaaaaay now I have it working, the trick is in this StackOverflow
post:

http://stackoverflow.com/questions/6183181/how-to-add-a-custom-widget-to-an-element

So in the end I did the following

in my jsni function

                var newDiv = $doc.createElement('div');

the function returns the div as an Element which I in turn wrap in an
HTMLPanel using HTMLPanel.wrap and then I add the widget!


On Aug 5, 10:06 am, Thomas Lefort <[email protected]> wrote:
> Hi John,
>
> Thanks again for your help and patience.
>
> The problem I have is that my widget is really quite a complex one,
> with in place field edits, help links etc... I really cannot
> reimplement, or bridge, every one handler of my widget, that's just
> not possible.
>
> There are two things that really puzzle me:
> - what exactly is going on? why do I loose all handlers when passing
> it as an element? I have not found much documentation on that.
> - how come it works when I use the map v2 infoWindow from the google
> gwt map library? There has to be some kind of trick.
>
> Cheers
>
> On Aug 4, 11:06 pm, John Ho <[email protected]> wrote:
>
>
>
>
>
>
>
> > Even though you are creating a new FlowPanel and adding your
> > propertiesEditor widget after passing it into the popup, it still doesn't
> > matter because you are passing the panel as an Element in your 
> > openInfoWindowWidget
> > method.
>
> > But to elaborate on the approach I mentioned, try this as an example:
>
> > public class YourPanel extends Composite {
> > JavaScriptObject clickFunction;
>
> > {
> > createJSNIBridge();
>
> > }
>
> > public YourPanel() {
> > Button button = new Button("Button");
> > button.getElement().setPropertyJSO("onclick", clickFunction);
>
> > FlowPanel panel = new FlowPanel();
> > panel.add(button);
> > initWidget(panel);
>
> > }
>
> > native void createJSNIBridge()/*-{
> > [email protected]::clickFunction = function() {
> > alert("Clicked!");
>
> > }
> > }-*/;
> > }
>
> > And then call openInfoWindowWidget(currentCoordinate, new YourPanel
> > ().getElement());

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