精华内容
下载资源
问答
  • DialogWindow

    2014-03-13 11:30:08
    Ext.ux.DialogWindow=Ext.extend(MyWindow,{ //DialogWindow继承了MyWindow width : 1000, height : 600, modal : true, layout:'fit', resizable : true, constrainHeader:true, closeAction:'close', ...

    一、Ext继承

    1、Ext.extend( Objectsubclass,Object superclass, [ Object overrides ]: Object )方法是用来实现类的继承。

          参数一:子类; 参数二:父类; 参数三:要覆盖的属性;

          子类继承下来的是父类中提供superclass.prototype方法定义的属性/方法。

    2、例子

          <script type="text/javascript">
    				      function S(){
    				      }
    				      S.prototype.s = "s";
    				      S.prototype.s1 = "s1";
    				      function C(){
    					     this.c = "c";
    					     this.c1 = "c1";
    				      }
    				      Ext.extend(C,S,{s1:"by c overload"});
    				      var c = new C();
    				      alert(c.s); //s
    				      alert(c.s1); //by c overload
    			</script>
    
    也可以:

              <script type="text/javascript">  
      	            function S(){  
      	            }  
      	            S.prototype.s = "s";  
      	            S.prototype.s1 = "s1";  
      	            C = Ext.extend(S,{s1:"by c overload"});  
      	            var  c = new C();  
      	            alert(c.s); //s  
      	            alert(c.s1); //by c overload  
              </script>
    

    二、Ext窗口

    1、Ext.Window介绍

          Ext.Window扩展自Ext.Panel,其xtype值为window。

    (1)主要配置项:

           closable:是否允许关闭窗口,默认true

           closeAction:关闭窗口的动作,包括2种:

                   close:从DOM删除窗口,销毁窗口及其所属元件,窗口不再可用,重新显示需要调用show方法。此为预设值。

                    hide:通过设置可见性隐藏窗口,窗口还可用,调用show方法后重新显示。

           constrain:是否约束窗口只能在容器内移动,默认false。窗口默认渲染到document.body

           constrainHeader:是否约束窗口头部只能在容器内移动,默认false

           draggable:是否可以拖曳,默认true

           resizable:是否可以改变窗口大小,默认true

           modal:是否为模式窗口,默认false

           maximizable:是否可以最大化窗口,默认false

           maximized:是否在初始化时最大化窗口,默认false

           x:窗口的X坐标值。

           y:窗口的Y坐标值。

           managerWindowGroup引用。

           expandOnShow:是否在窗口显示时展开,默认true。当取值false时,collapsed取值true时,窗口初始显示时收缩。

           minimizable:是否可最小化窗口,默认false。需自定义最小化行为。

           defaultButton:当窗口获得焦点时,默认获得焦点的按钮。

           plain:主体背景是否透明,默认false

    (2)主要方法

          show( [String/Element animateTarget], [Functioncallback], [Object scope] ):显示窗口。

         hide([String/Element animateTarget], [Function callback], [Object scope] ):隐藏窗口。

         center():窗口居中显示。

         close():关闭窗口,相当于closeAction值为close的情况。

         maximize():最大化窗口。

         restore():还原窗口大小。

         toggleMaximize():在最大化和还原之间切换。

         minimize():最小化窗口。

         setActive(Boolean active ):启动窗口。

         focus():窗口获得焦点。

         toBack():后置窗口。

         toFront([Boolean e] ):前置窗口。

         resize( Ext.Window this, Number width, Number height):改变大小

    三、实现DialogWindow

    (1)定义一个js文件 

    var MyWindow = function(config) {
        Ext.apply(this, // 在这里设置预配置的参数项
        		{items:[]}
        );
        MyWindow.superclass.constructor.apply(this, arguments);
        this.on('show',function(){
              //show時让窗口居中,如果居中后窗口的X,Y坐标小于0,则重新设置窗口坐标为0
              this.center();
              var el=this.getEl();
              if(el.getX()<0||el.getY()<0){
                 el.setXY([0,0],true);
              }
        });  
    };

    Ext.extend(MyWindow, Ext.Window, {// MyWindow继承了Ext.Window
        onRender: function() {
           	MyWindow.superclass.onRender.apply(this, arguments);
        }
    });
    

    Ext.ux.DialogWindow=Ext.extend(MyWindow,{ //DialogWindow继承了MyWindow
    	width : 1000,
    	height : 600,
    	modal : true,
    	layout:'fit', 
    	resizable : true,
    	constrainHeader:true,
    	closeAction:'close',
    	maximizable : true,
    	listeners: {
    		close:function(w){
     			//关键部分:关闭窗口前先还原,滚动条才不会消失
    			w.restore();
    		},
    		maximize:function(w){   
    		     //关键部分:最大化后需要将窗口重新定位,否则窗口会从最顶端开始最大化                      
    			w.setPosition(document.body.scrollLeft,document.body.scrollTop);
    		}
    	}  ,
    	onRender : function(ct, position){
    		Ext.ux.DialogWindow.superclass.onRender.call(this, ct, position);
    		this.items.add(new Ext.ux.IFrameComponent({frameid: this.frameid , url:this.url}));
    	}
    });
    

    //构建类似Iframe块
    	Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent, {
            onRender : function(ct, position){
                this.el = ct.createChild({tag: 'iframe',id: this.frameid||'dialogframe' ,frameBorder: 0, src: this.url});
            }
        });
    

    【为了尽量减少代码的修改量,封装一个比较常见的重复动作,定义一个新的方法openSubWnd】
    function openSubWnd(id, title, width, height, url, fn, resizable, modal) {
    	//设置resizable,modal预设值
    		if (resizable == null) {
    			resizable = true;
    		}
    		if (modal == null) {
    			modal = true;
    		}
    		win = new window.top.Ext.ux.DialogWindow( {
    			id : id,
    			title : title,
    			width : width,
    			height : height,
    			modal : modal,
    			layout : 'fit',
    			resizable : resizable,
    			url : url,
    			callBack : fn || function() {
    			}
    		});
    		win.show();
    	}
    

    进度条

    Ext.ProgressBar.prototype.wait=function(o){
       		if(!this.waitTimer){
            		var scope = this;
            		o = o || {};
            		this.waitTimer = Ext.TaskMgr.start({
                		run: function(i){
                    	var inc = o.increment || 10;
                    	this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01);
                    	if(i<=60){
                    		this.updateText(i+"秒");
                    	}else{
                    		var minute=parseInt(i/60);
                    		var second=i%60;
                    		this.updateText(minute+"分"+second+"秒");
                    	} 
                	},
                	interval: o.interval || 1000,
               	   duration: o.duration,
               	   onStop: function(){
                   	     if(o.fn){
                         		o.fn.apply(o.scope || this);
                         }
                   	     this.reset();
               	   },
                	   scope: scope
            	});
       	 }
        	 return this;
    };
    



    展开全文
  • Quit dialog window

    2020-12-08 20:13:46
    s confirm quit dialog window in the original game. It appears in a case we push the quit button or just press window's close button.</p><p>该提问来源于开源项目:ihhub/fheroes2</p></div>
  • <ul><li><strong>Description of Issue</strong>: </li><li>Result: There is a chance that npc dialog window will got vanished after you clicked an npc (ex. Quest Shop) and you got stock which you cannot ...
  • <div><p>Maximize button for ...t maximize dialog window. On 7" with 800x480 touch screen it is very difficult to use. <p>Thanks, --MG</p><p>该提问来源于开源项目:OpenCPN/OpenCPN</p></div>
  • <div><p>When a menu is opened on a non-modal dialog, it gets covered by the dialog window. <p>Here's a fiddle for the latest library version: <p>http://jsfiddle.net/BN9Tu/2/</p> <p>I've tested...
  • When I open any dialog window of Java application and move my mouse(which changes focus from dialog window to other window) to this opened dialog window, cpu usage spikes for a few seconds and dialog...
  • Add dialogWindow to the API

    2021-01-01 04:19:04
    <p>Rather than client I think we should call this new feature <code>dialogWindow, since it's not equal to ...
  • <p>How would one be able to create a dialog window to search through the entire clipboard history, find an entry based on the item's content and paste it into the current selection? <p>I imagine a...
  • <p>A Button on the Dialog Component, that closes the dialog window, auto-focuses on setting the state of the Dialog box to open. When the Dialog window is closed and re-opened, the close button is ...
  • t cancel a copy or paste dialog window with cancel button. -bit: maybe not related but as you recently work on dialog windows. <p><strong>To Reproduce 1. Select an image in lighttable 2. Open the copy...
  • m using Adguard adblock extension on Safari and sometimes Adguard dialog window is blank. <h3>Steps to reproduce <p>I'm unable to reproduce it, it seems to be random. <h3>Expected behavior <p>When...
  • <p>Dialog window to confirm closing tree of tabs is blank (white). <h2>Steps to reproduce <ol><li>Start Firefox with clean profile.</li><li>Install TST.</li><li>Open multiple tabs in one tree.</li><li...
  • when pressing Return, the same dialog window reappears (inifinite loop). There is not way to quit the dialog window. <p>Expected: the same on a local folder: when pressing Return, the dialog window ...
  • <div><p>Open file dialog window not handled by berry. <pre><code> $xprop _NET_WM_USER_TIME(CARDINAL) = 3644362 _NET_WM_STATE(ATOM) = _NET_WM_STATE_MODAL WM_HINTS(WM_HINTS): Client accepts ...
  • This would not necessarily delete the log file itself but would limit what is shown in the dialog window (it would only show the log file since the last "clear log window" command. <p>I spent...
  • <div><p>I have a problem with the dialog window size in the portrait mode when running my app against S5 phone. here is a snapshot: How to solve this issue? </p><p>该提问来源于开源项目:yukuku/...
  • <p>When i right-click on the npm node witch appears at the project explorer on my node.js project, and then select the option to install new packages, it should open the npm ui dialog window. ...
  • <div><p>We are initiating an SAML SSO flow in a dialog window that is opened via an Outlook plugin. The login flow completes but we are not able to call the messageParent method on the Mac Outlook ...
  • Android Dialog Window探究

    2020-05-28 02:31:58
    DialogWindow 的DecorView 的边距 常见问题:Dialog 无法设置全屏 原因:Window 的 LayoutParams 为 WindowManager.LayoutParams.MATCH_PARENT 时,并且没有为 Window 对应的 DecorView 设置 背景色时: 没有...

    一、Dialog 的Window 的DecorView 的边距

    常见问题:Dialog 无法设置全屏
    原因:Window 的 LayoutParams 为 WindowManager.LayoutParams.MATCH_PARENT 时,并且没有为 Window 对应的 DecorView 设置 背景色时:

    • 没有设置android:windowBackground
    • 没有手动为DecorView 设置背景色。

    此时DecorView 会 为自己设置padding 。导致Dialog 内容无法充满全屏。
    解决方案:设置背景。

        <style name="ShareDialog"  parent="android:Theme.Dialog">
            <item name="android:windowFrame">@null</item>
            <item name="android:windowNoTitle">true</item>
            <item name="android:background">@android:color/white</item>
            <item name="android:windowBackground">@android:color/white</item>
            <item name="android:windowIsFloating">true</item>
            <item name="android:windowContentOverlay">@null</item>
        </style>
    

    二、style 属性 android:windowBackground 与 DecorView 的背景

    Window 的背景最终是设置到到对应的DecorView 背景。

    三、DialogFragment 的 Window 的LayoutParams变化

    • 默认的 Dialog 的 Window 的LayoutParams 在window.setContentView(dialogView)调用前,为 MATCH_PARENT。
    • Dialog 调用window.setContentView(dialogView) 方法设置内容后,Window 的LayoutParams 被修改为WRAP_CONTENT。 所以如果想要修改Window 的 LayoutParams ,需要在setContentView方法调动后。
    • DialogFragment 的onStart 调用时,会重新设置 Window 的LayoutParams 为WRAP_CONTENT。

    所以,如果想要使用Window 为MATCH_PARENT 模式,需要在onStart 调用时,重新设置Window 的LayoutParams 为MATCH_PARENT。

    四、Dialog 的ContentView 的LayoutParams与Window的关系

    常见问题:Dialog 对应的布局文件match_parent 失效
    根据View 的 onMeasure( MesureSpec spec) ,MesureSpec 的生成原则 。取决于 父View的MesaureSpec 和自身的LayoutParams 。

    • DecorView 的 LayoutParams 与Window 是保持一致的 。
    • 当父View 为 WRAP_CONTENT。自身布局文件中的 width 不管为 wrap_content还是 match_parent,都没啥用,MesureSpec 都是 AT_MOST 模式。

    所以想要控制Dialog 对应布局文件的 大小 ,需要设置Window 的LayoutParams。

    展开全文
  • <div><p>this fixes the not selectable scrolled box in date plugin dialog window</p><p>该提问来源于开源项目:mate-desktop/pluma</p></div>
  • <div><p>Errors/warnings/log messages should appear in a dialog window when the kicost GUI is used. (Not in the terminal window.)</p><p>该提问来源于开源项目:xesscorp/KiCost</p></div>
  • Fix dialog window focus

    2020-12-26 04:25:52
    <div><p>Fixes issues with dialogs not returning to focus when app is switched to and also showing up in alt+tab list separate from the main program.</p><p>该提问来源于开源项目:...
  • However, upon calling the method, I get a dialog window asking whether I want to share to Direct, Story, or Feed. I want to always share to Feed and not have this window show up at all. How can I do ...
  • <div><p>In regard to the issue #20 <p>User can specify an html page as a custom alert.</p><p>该提问来源于开源项目:G07cha/pomodoro</p></div>
  • <div><p>As stated in https://github.com/danny0838/firefox-scrapbook/issues/108#issuecomment-237453712, Firefox Mac sometimes does not show all contents when the content outflows the dialog window. ...
  • <p>Just closes the mini-account menu dialog window. Nothing else happens. <p>Intended behavior is to bring up the full Settings dialog on the Accounts tab.</p><p>该提问来源于开源项目:Chatterino...
  • </li><li>Operating system version: Windows</li><li>Expected behavior: The animated .gif normally animate.</li><li>Actual behavior: Not animated on dialog.Show(), but work with dialog.ShowDialog()</li>...
  • t have tool-tips on snapshot dialog window from VM sidebar (storage > view all button) <p>Steps: 1. Go to Virtual machines 2. Select VM and go to Storage tab in the sidebar (you need to find VM ...
  • ll try it again here (this is copy paste from other post <a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/2defee3c-fcbd-4e3f-afa1-aae21933f129/touches-from-dialog-window-get-...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 9,069
精华内容 3,627
关键字:

dialogwindow