Tuesday, November 29, 2011

Re: getOffsetHeight returns 0 although onload has been called

From what I have found is the objects need to be visable in the
Document object first.
So try this:

public static void adjustHeight(final DockLayoutPanel topPanel, final
SimplePanel bodyPanel, final DockLayoutPanel outerPanel, final boolean
isIpad)
{
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand()
{
public void execute()
{
// do your stuff.

outerPanel.forceLayout();
}
});
}

let me know if this help!

On Nov 29, 10:08 am, George Agiasoglou
<George.Agiasog...@newsint.co.uk> wrote:
> Hi group,
>
> Consider an application which has a *DeckLayoutPanel* as a shell, and has
> two DockLayoutPanel as children, which means only one child is shown at any
> time. I am using MVP with Activities and Places, there are two places and
> each place corresponds to displaying a child.
>
> When the app is initialised both children are injected (by gin) and added
> to the *DeckLayoutPanel.*
>
> And looks like
>
> class MyApplication {
>
>  MyApplication(DockLayoutPanel child1, DockLayoutPanel child2) {
>  ...}
>
>  ...
>
> }
>
> Application displays child1, user changes to other place to display child2.
> Everything is displayed fine however I need to calculate an area
> using getOffsetHeight and getOffsetWidth, however both calls return 0. If
> now I change the token of the place in the url to another valid token both
> calls return actual values.
>
> Any ideas why this is happening?
>
> Thanks,
> G
>
> --
> "Please consider the environment before printing this e-mail"
>
> The Newspaper Marketing Agency: Opening Up Newspapers:
>
> http://www.nmauk.co.uk/
>
> This e-mail and any attachments are confidential, may
> be legally privileged and are the property of NI Group
> Limited (which is the holding company for the News
> International group, is registered in England under number
> 81701 and whose registered office is 3 Thomas More Square,
> London E98 1XY, VAT number GB 243 8054 69),
> on whose systems they were generated.
>
> If you have received this e-mail in error, please notify
> the sender immediately and do not use, distribute, store
> or copy it in any way.
>
> Statements or opinions in this e-mail or any attachment
> are those of the author and are not necessarily agreed
> or authorised by NI Group Limited or any member of its
> group.
>
> NI Group Limited may monitor outgoing or incoming
> emails as permitted by law. It accepts no liability
> for viruses introduced by this e-mail or attachments.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment