日期:2014-05-16  浏览次数:20323 次

LearningExtJS_new 之 windows and dialog 的应用学习(七) PART I
Ext.onReady(function(){
//一.alert 对话框,参数(标题,内容)
//二.prompt 对话框 参数(标题,内容,回调函数,scope,是否多行[ok or cancel])
//三.confirm 确认框 参数(标题,内容,回调函数 yes or no)
//四.progress 进度条 参数(标题,内容,进度条内容)
//	调用updateProgress方法可以更新进度的内容
//	调用hide方法来隐藏所有msg内容.
//五.自定义对话框
//	show({})方法,加一些配置项,主要是title,msg,buttons,icon,fn之类
//六.行为
//	其它一些配置,如progress:ture 相当于progress,prompt相当于prompt.modal模态窗口.fn
//七.window窗口
//1.window的msg的父类,可以使用window来自定义一些信息,展示.
//八.panel相关.(window的父类)
//	@layout配置,同panel设置
//	@items配置:用数组.用form的组件
//	@autoWidth:true,自动设置宽度
//	@autoHeight:true,自动设置高度
//	@maximizable 自动最大化 
//	@minimizable 最小化,必须自动实现方法
//	@collapsible 可折叠
//	@expandOnShow 显示时展示信息
//	@tbar 配置
//	@bbar配置
//	@buttons 配置
//九.其它一些方法及事件
//	@minimize事件,最小化时处理
//	@restore从最大化到原始大小的处理
//	@toggleMaximize最大化处理.
//	@center in the middle of browser's viewport
//十.事件
//	1.stateful: true,状态记忆
//	2.stateevents:['minimize','maximize']记忆事件
//十一.window窗口管理
//	
	
//	//提示
//	Ext.Msg.alert("标题","内容");
//	//提示框
//	Ext.Msg.prompt("提示框","内容",function(btn,text){
//									if(btn == "ok"){
//										console.debug(text);
//									}else if(btn == "cancel"){
//										console.debug("cancel");
//									}
//								},this,false);
//	//确认框
//	Ext.Msg.confirm("标题","内容",function(btn,text){
//									if(btn == "yes"){
//										console.debug("yes!!!");
//									}
//								});
//	//进度条							
//	Ext.Msg.progress("标题","测试","正在下载...");
//	var count = 0;
//	var interval = window.setInterval(function(){
//										count += 0.04;
//										Ext.Msg.updateProgress(count,Math.ceil(count*100) + "%");
//										if(count > 1){
//											window.clearInterval(interval);
//											Ext.Msg.hide();
//										}
//									},1000);
//	
//	//自定义
//	Ext.Msg.show({
//					title:"自定义标题",
//					msg:"自定义对话框",
//					icon:Ext.MessageBox.INFO,
//					buttons:{yes:true,no:true,cancel:true},
//					width: 300
//				});
//	//行为
//	Ext.Msg.show({
//						title : "测试",
//						msg : "内容",
//						prompt : true,
//						multiline : true,
//						buttons:Ext.Msg.YESNO 
//					});
	//window配置
	var w = new Ext.Window({
								width:200,
								height:300,
//								autoWidth:true,
//								autoHeight:true,
								title:"测试窗口",
								html:"<b>Test</b><hr/>context hereontext hereontext hereontext hereontext hereontext here<br/>" +
										"ontext hereontext hereontext hereontext hereontext hereontext hereontext hereontext here<br/>" +
										"ontext hereontext hereontext hereontext hereontext hereontext here<br/>" +
										"ontext hereontext hereontext hereontext hereontext here<br/>",
								maximizable:true,
								minimizable:true,
								collapsible:true,
								expandOnShow:false,
								tbar:[{text:"top bar"}],
								bbar:[{text:"bottom bar"}],
								buttons:[{text:"check"}],
								stateful: true,
								stateevents:['minimize','maximize']
							});
	w.show("txtNull", function() {
				//alert("test")
			});
	
	
	w.on("minimize",function(){
//		console.debug("minimize");
		w.collapse(false);
		w.alignTo(document.body,"bl-bl");
	});
//	w.on("maximize",function(){
//		console.debug("maximize");
//	});
	w.on("restore",function(){
		console.debug("restore");
	});
//	w.on("maximize",function(){
//		console.debug("maximize");
//	});
	//panel特征及配置
//	var wp = new Ext.Window({
//							layout:"form",
//							items:[
//									{
//										xtype:"textfield",
//										fieldLabel:"姓名"
//									},
//									new Ext.form.TextField({fieldLabel:"地址"})
//								],
//							width:300,
//							height:200,
//							closable:false,
//							draggable:false,
//							resizable:false
//						});
//	wp.show();
});