PDA

View Full Version : TabItem in TabPanel not sized correctly



derek_111@yahoo.com
11 Sep 2009, 3:09 PM
Hello,

I am trying to put a tabitem into a tabpanel.
It doesnt appear to be sizing the tabitem correctly.
I need to use a borderlayout because i have a tree in the west side. For this example i have removed it though.
I also must have the tabpanel.add(tab) statement after the RootPanel.get().add(viewport) because when a user double clicks a node in the tree it opens/adds a tabitem to the tabpanel. I have removed all of that code though in order to create the smallest possible code example of the problem. I have tried calling viewport.layout() after adding the tabitem, but that does not work. I am at a loss as to what else i need to do. seems like a simple thing to me. If you look at the screenshot you will see on the right side that the scrollbar is going below the window.

public void onModuleLoad() {
BorderLayoutData layoutData;

viewport.setLayout(new BorderLayout());

TabItem tab = new TabItem("tab");
tab.setLayout(new FitLayout());
tab.add(new TextArea());

layoutData = new BorderLayoutData(LayoutRegion.CENTER);
layoutData.setSplit(true);

viewport.add(tabPanel, layoutData);

RootPanel.get().add(viewport);

tabPanel.add(tab);
}

sven
11 Sep 2009, 3:20 PM
That is already fixed in SVN. There are two solutions for you.

1) Add the tabitem before attaching the viewport

2) Call syncsize on the tabpanel after adding the tabitem

derek_111@yahoo.com
11 Sep 2009, 4:11 PM
That worked! thanks.