Wednesday, January 15, 2014

Re: How to adjust a GWT frame height to get no scrollbars (100% of body content)?

1)
in my ViewImpl-Class in the Consructor I have to create the frame and load the content.
The content (html-url) is from my war-directory:
frame = new Frame(GWT.getHostPageBaseURL() + "ClientData/myhtml.html");
frame.getElement().setId("framename");

=> $doc is right here because it is in my domain?

$doc is correct because you are in a GWT app. GWT is executed in an iFrame and if you would only write "document" you would get the iFrame document and not the window document. Same with $wnd. So in a GWT app you always use $wnd and $doc inside JSNI functions to access the top level window and document.
 

2)
After that I should wait until the frame content is fully loaded.
=> How can I handle this?? 

Frame.addLoadHandler(). 

 
3)
If the content is loaded I call the setFrameSize()-Method.
    public native boolean setFrameSize (String id)
    /*-{
            var newheight;
            var newwidth;
            var frame = $doc.getElementById(id)
       
            if(frame !=null){
                newheight=frame.contentWindow.$doc.body.scrollHeight;
                newwidth=frame.contentWindow.$doc.body.scrollWidth;

As already said in my previous reply: $doc is a GWT variable and if your Frame does not show a GWT app then this variable does simply not exist in that Frame. Instead of $doc you then have to use "document": frame.contentWindow.document.body.scrollWidth.


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate