PDA

View Full Version : TabPanel - resize problem with the TabItem-Header-Label



msauter
11 Sep 2009, 7:26 AM
I want that the size of the Tabs-Header, shown in the TabPanel, automatically changes, when i change the Text of the Header. I used the "Advanced Tabs Example" from http://www.extjs.com/examples/explorer.html#advancedtabs

I changed only the method "addTab" to create Tabs with a longer Text.



private void addTab() {
TabItem item = new TabItem();
item.setText("New Tab xxxxxxxxxxxxxxxxx " + ++index); // my change
item.setClosable(index != 1);
item.addText("Tab Body " + index);
item.addStyleName("pad-text");
advanced.add(item);
}


ResizeTabs is set to true


advanced.setResizeTabs(true);


The problem is, that the Tabs do not change their Header-size, when i change the Text (see picture). The only point where i can change the width of the Header, is when i set the "MinTabWidth":

advanced.setMinTabWidth(115);


Is this a bug or missing feature or i am totally wrong?

sven
11 Sep 2009, 7:31 AM
There is a tabWidth defined in tabpanel. You probably want to change that.

msauter
11 Sep 2009, 11:32 AM
The problem is, i dont know the size of the Tab when i change the Text. There must be some kind of autosize.

Arno.Nyhm
14 Sep 2009, 8:05 AM
maybe as workaround: you can calculate the textsize with a helper function TextMetrics. if you search the forum you find also some codesnippets how to use it :-)

http://www.extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/util/TextMetrics.html