activeItem 是从tabpanel的items集合来说的.
而activeTab又是另外一个层次.
[code="js"]
//这个是TabPanel里面的一部分源代码,可以看出来他的默认布局采用Cardlayout
this.setLayout(new Ext.layout.CardLayout({
deferredRender: this.deferredRender
}));
//...........
this.layout.setActiveItem(item);//在tabpanel里面就是通过设置cardlayout的这个方法来显示那个panel
[/code]
而在CardLayout里面这个方法的源代码又是这样的
[code="js"]
/**
* Sets the active (visible) item in the layout.
* @param {String/Number} item The string component id or numeric index of the item to activate
*/
setActiveItem : function(item){
item = this.container.getComponent(item);//从布局容器里面获得这个 item
if(this.activeItem != item){
if(this.activeItem){
this.activeItem.hide();
}
this.activeItem = item;
item.show();
this.layout();
}
}
[/code]
activeItem是定义在CardLayout中的。