⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionsscript.cs

📁 经典编程900例(C语言),主要是C基础知识
💻 CS
字号:
using System;
using System.DHTML;
using Ext;

namespace SampleScripts.menu {
    public class ActionsScript {

        public static void main(Dictionary args) {
			ExtClass.onReady(new AnonymousDelegate(delegate() { new ActionsScript().init(); }));
        }

        public void init() {
			Action action = new Action(new ActionConfig()
				.text("Action 1")
				.handler(new AnonymousDelegate(delegate
					{
						MessageBox.alert("Click", "You clicked on \"Action 1\".");
					}))
				.iconCls("blist")
				.ToDictionary());

			Panel panel = new Panel(new PanelConfig()
				.title("Actions")
				.width(600)
				.height(300)
				.custom("bodyStyle", "padding: 10px;")	// lazy inline style

				.tbar(new object[] {
					action,								// <-- Add the action directly to a toolbar
					new Dictionary(
						"text", "Action Menu",
						"menu", new object[] {action})	// <-- Add the action directly to a menu
				})

				.items(new object[] {
					new Ext.Button(action)				// <-- Add the action as a button
				})

				.renderTo(ExtClass.getBody())
				.ToDictionary());

			// Buttons added to the toolbar of the Panel above
			// to test/demo doing group operations with an action
			panel.getTopToolbar().add("->", new Dictionary(
				"text", "Disable",
				"handler", new AnonymousDelegate(delegate {
					action.setDisabled(!(bool)Type.InvokeMethod(action, "isDisabled"));
					Type.InvokeMethod(this, "setText", (((bool)Type.InvokeMethod(action, "isDisabled")) ? "Enable" : "Disable"));
				})),
				new Dictionary(
				"text", "Change Text",
				"handler", new AnonymousDelegate(delegate {
					MessageBox.prompt("Enter Text", "Enter new text for Action 1:", new MessageBoxResponseDelegate( delegate (string btn, string text) {
						if (btn == "ok" && !String.IsNullOrEmpty(text)) {
							action.setText(text);
							action.setHandler(new AnonymousDelegate(delegate {
								MessageBox.alert("Click", "You clicked on \"" + text + "\"");
							}));
						}
					}));
				})),
				new Dictionary(
					"text", "Change Icon",
					"handler", new AnonymousDelegate(delegate {
						action.setIconClass(((string)Type.InvokeMethod(action, "getIconClass")) == "blist" ? "bmenu" : "blist");
					}))
			);
		}
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -