PDA

View Full Version : Too many panels/tabs in BorderLayout



Illiarian
18 Apr 2007, 5:45 AM
If I add so many panels to the layout that tabs don't fit on screen, they silently disappear to the right with no chance to retireve them by mouse:

http://dmitriid.com/files/varia/ext/tabs.jpg

Is there a way to add scrolling to those tabs?

Thank you

tryanDLS
18 Apr 2007, 8:17 AM
Look at the TabPanel doc. You can tell it to resize the tabs and also set a min/max width, so they'll shrink as you add more.

Illiarian
18 Apr 2007, 11:42 PM
Well, the thing is - how do I get hold of the TabPanel that is created by the BorderLayout?

Because it says:
The layout manager will automatically create and/or remove the TabPanel component when a region has more than one panel.

And there are no methods that I can see that allow me to retrieve the TabPanel from the layout...

Illiarian
19 Apr 2007, 5:12 AM
So, what would be the procedure for getting hold the required TabPanel and setting its settings? (upping this up, as many will definitely run into this problem, I think)

haibijon
19 Apr 2007, 5:23 AM
You have to get the TabPanel from the LayoutRegion, not the Layout itself. First choose the region you want to modify the tabs for, then call getTabs() to get the tab panel for that region

For Instance:


var layout = new Ext.BorderLayout(Ext.id(), { ... etc ... });

var centerRegion = layout.getRegion('center'); // this gets the (center) layout region from the Layout itself

var tabs = centerRegion.getTabs(); // this returns the



After getting the tab panel you can work with the tabs like you would any other tab panel. All of the public properties and methods are listed here (http://extjs.com/deploy/ext/docs/output/Ext.TabPanel.html) in the docs.

Havn't tried it, but you should be able to set the public properties for min/max size as well as auto resizing, and then call autoResizeTabs() to manually render the tabs with the new settings.

Illiarian
19 Apr 2007, 6:47 AM
Thanks! That was most helpful! And worked perfectly!