Thursday, December 4, 2014

Re: TabLayoutPanel - forcing onResize for unselected tab content

Assuming that the problem is that the ProvidesResize, RequiresResize chainis broken somewhere...

Generally one of the trickiest (at least for me) puzzles in GWT is to find where the ProvidesResize, RequiresResize chain breaks. It may be a Composite from a uibinder file (instead of a ResizeComposite), it may be a FlowPanel somewhere in between or who knows... Generally by looking on the inspector of your browser you should be able to map (requires some practice) the hierarchy of divs to GWT widgets.

If I had to guess in your case I would make sure that

1) the TabLayoutPanel is explicitly sized or inside an explicitly sized element or a layout panel up to the top which should be a RootLayoutPanel (or explicitly sized ).
2) the inner SimplePanel is not a layoutpanel so it does not have a onResize() method AFAIK. Try to exchange it with a real layoutPanel such as ResizeLayoutPanel. It depends on what you need to do,

Bye









On Thu, Dec 4, 2014 at 8:15 PM, Magnus <alpineblaster@gmail.com> wrote:
Hi,

I implemented the resizing as in Vassilis' code. But when calling the inner line

((RequiresResize) w).onResize();

the size of the chess board is still zero!

So I replaced this inner line with this:

scheduleResize((RequiresResize) w);
...
private void scheduleResize (RequiresResize wgt)
{
 Scheduler.get().scheduleDeferred
 (
  new ScheduledCommand()
  {    
   @Override
   public void execute()
   {
    onResize();
   }
  }
 );
}

Well, this works, but whenever I select a tab, I first see the board at the upper left, and then immediately I see it at the center.

Why does this not work for me without deferred code, while it seems to work for Vassilis?

My hierarchy is like this:
TabLayoutPanel -> DockLayoutPanel -> SimplePanel
I also verified that this chain of onResize events is executed. The inner one (SimplePanel) gets zero widths when not deferred.

Magnus

--
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/d/optout.



--
Vassilis Virvilis

--
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/d/optout.

No comments:

Post a Comment