📄 tabscript.cs
字号:
using System;
using System.DHTML;
using Ext;
namespace SampleScripts.tabs {
public delegate void TabPanelActivateDelegate(TabPanel tab);
public class TabScript {
public static void main(Dictionary args) {
ExtClass.onReady(new AnonymousDelegate(delegate() { new TabScript().init(); }));
}
public void init() {
// basic tabs 1, built from existing content
new TabPanel(new TabPanelConfig()
.renderTo("tabs1")
.width(450)
.custom("activeTab", 0)
.frame(true)
.defaults(new Dictionary("autoHeight", true))
.items(new object[] {
new Dictionary("contentEl", "script", "title", "Short Text"),
new Dictionary("contentEl", "markup", "title", "Long Text")
})
.ToDictionary());
// second tabs built from JS
new TabPanel(new TabPanelConfig()
.renderTo(Document.Body)
.custom("activeTab", 0)
.width(600)
.height(250)
.custom("plain", true)
.defaults(new Dictionary("autoScroll", true))
.items(new object[] {
new Dictionary("title", "Normal Tab", "html", "My content was added during construction."),
new Dictionary("title", "Ajax Tab 1", "autoLoad", "ajax1.htm"),
new Dictionary("title", "Ajax Tab 2", "autoLoad", new Dictionary("url", "ajax2.aspx", "params", "foo=bar&wtf=1")),
new Dictionary("title", "Event Tab", "listeners", new Dictionary("activate", new TabPanelActivateDelegate(HandleActivate)), "html", "I am tab4's content. I also have an event listener attached."),
new Dictionary("title", "Disabled Tax", "disabled", true, "html", "Can't see me cause I'm disabled")})
.ToDictionary());
}
private static void HandleActivate(TabPanel tab)
{
MessageBox.alert("Alert", tab.title + " was activated.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -