Results 1 to 2 of 2

Thread: [fixed] Aligning an Ext.Window

  1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    30
    Vote Rating
    7
      0  

    Default [fixed] Aligning an Ext.Window

    I have two windows in my application that both open in a center by default, but I want to align them so that first opens aligned to the left of the screen ant the other to the right of the screen, so that windows are always aligned in a different resolutions. (x/y don't work in this case).

    Also is there a way that new window that will be opened, align his upper-left corner in the point (let's say 200px left and up from center of the screen) and every other opened window aligns 20px less than the first (to make that cascading windows look).

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Posts
    30
    Vote Rating
    7
      0  

    Default

    I found a solution with this: var browserWidth = Ext.lib.Dom.getViewWidth();

    And for the other question I did it this way, if someone knows a better one please reply.

    Code:
    var xGlob = 200;
    var yGlob = 200;
    Ext.ux.Window = Ext.extend(Ext.Window, {
    
        constructor: function(config) 
        {
            var browserWidth = Ext.lib.Dom.getViewWidth();
            var browserHeight = Ext.lib.Dom.getViewHeight();
        
            var x = (browserWidth/2)-xGlob;
            var y = (browserHeight/2)-yGlob;
        
            config = Ext.apply({
                layout: 'fit',
                closable: true,
                closeAction: 'hide',
                resizable: true,
                draggable: true,
                x: x,
                y: y,
                plain: true,
                border: false,
                listeners:
                {
                    show: function()
                    {
                        xGlob = xGlob-20;
                        yGlob = yGlob-20;
                    }
                }
            }, config);
            
            Ext.ux.Window.superclass.constructor.call(this, config);
        }
    });

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •