Hi Lara

you can not replace the element with your button becasue your Button is a Widget
while the button that you want to put in there must be a ButtonElement

why ?
because the Widget are used by GWT to translate that code into javascript.
Once translated in javascript work is done.
In your case you download a web page with the Frame, then google ALSO provides mechanism to manipulate html page and Javascript so your html page now must be handled by a reverse engineering and threat that button as a ButtonElement

is that clear ?

Il 27/10/2012 23:38, Hugues Lara ha scritto:
To be honest i don't get it at all ...
An other idea was to get the Document of the Iframe. That i got it , i even find the element i want by parsing the html. But i dunno how replace this Element by a GWT button attached to my main module ( I think it's necessary to show my popup ).

Thanks,

On Saturday, October 27, 2012 4:28:03 PM UTC-5, Fabio wrote:

    No you can't do that, but you have to take this other way:

    extending our target, you want to add a Widget, because your
    button is a Widget, into a Document as javascript language provides.
    Infact you get a Document made by Elements.

    So I think you have to use the method appendChild where the child
    is a ButtonElement

    see

    
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/index.html?com/google/gwt/dom/client/ButtonElement.html
    
<http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/index.html?com/google/gwt/dom/client/ButtonElement.html>

    so you have to simulate javascript.

    The Button you mean is a Widget and use to CREATE a javascript, in
    that case everything has been already translated into javascript


    is that clear ?

    Il 27/10/2012 22:56, Hugues Lara ha scritto:
    Hi,

    My goal is to set gwt button inside my iFrame. If I do a
    RootPanel.get("my id").add(myButton) , it don't work because the
    id is inside the iFrame.
    I find out how get the Document of the iframe and get the Div
    Element but i still don't know how set a button on this div.

    Thanks,

    On Saturday, October 27, 2012 3:38:59 PM UTC-5, Fabio wrote:

        Hi

        did you add a ClickHandler ? it doesnt seems to implements a
        clickHandler

        bye


        Il 27/10/2012 22:07, Hugues Lara ha scritto:
        Hi,

        I am actually migrate a web application to GWT. In order to
        reuse the existing page i put them in frame. However i have
        to develop a new popup for one of them and i would like to
        let this popup attached to the main module.
        Before i was parsing the html to get the element and with
        RootPanel attach a button. I can't do that anymore because
        it's in an Iframe.
        So i try to fire an event on click inside the iFrame to get
        the current element and if it's the right button show the
        popup ...

        The ONLOAD event work pretty well but the ONCLICK don't work
        at all

        my code sample :

        package com.exp.client;

        import com.google.gwt.user.client.DOM;
        import com.google.gwt.user.client.Event;
        import com.google.gwt.user.client.ui.Frame;
        import com.google.gwt.user.client.Window;

        public class CustomFrame extends Frame {
        public CustomFrame(){
        sinkEvents(Event.ONCLICK);
        sinkEvents(Event.ONLOAD);
        setUrl("http://www.google.com"; <http://www.google.com>);
        setSize("900px","900px");
        }
        public void onBrowserEvent(Event event){
        super.onBrowserEvent(event);
                switch (DOM.eventGetType(event))
                {
                case Event.ONCLICK:
                    Window.alert("ONCLICK : "+
        event.getEventTarget().toString() );
                    DOM.eventPreventDefault(event);
                    break;
                case Event.ONLOAD:
        Window.alert("ONLOAD");
                    DOM.eventPreventDefault(event);
                    break;
                }
            }
        }

        Thanks for your help
-- You received this message because you are subscribed to the
        Google Groups "Google Web Toolkit" group.
        To view this discussion on the web visit
        https://groups.google.com/d/msg/google-web-toolkit/-/-_OuFX0mHJUJ
        <https://groups.google.com/d/msg/google-web-toolkit/-/-_OuFX0mHJUJ>.
        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
        <http://groups.google.com/group/google-web-toolkit?hl=en>.

-- You received this message because you are subscribed to the
    Google Groups "Google Web Toolkit" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/google-web-toolkit/-/9ooi7wPMfIAJ
    <https://groups.google.com/d/msg/google-web-toolkit/-/9ooi7wPMfIAJ>.
    To post to this group, send email to
    [email protected] <javascript:>.
    To unsubscribe from this group, send email to
    [email protected] <javascript:>.
    For more options, visit this group at
    http://groups.google.com/group/google-web-toolkit?hl=en
    <http://groups.google.com/group/google-web-toolkit?hl=en>.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ThnSB9ylmsQJ.
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.

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