[CLOSED] Show Desktop window maximized - strange behavior

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Show Desktop window maximized - strange behavior

    Hi.

    I am trying to show a Desktop window maximized initially when shown.

    I saw this thread: http://forums.ext.net/showthread.php...ndow-maximized

    and based on this, I added my 'Show window' function the parameter mMaxi that when given an 'M' will call maximize() method after showing it.

    The problem is that this produces strange behavior. The window shows maximized, but without the minimize button. Only shows the colse and restore button. If restore is clicked, the window virtually dissapears and only a small square with window title, close and maximize buttons are shown in the middle of the screen.

    I paste the code and both images (maximized and restored window)

    Function to open windows:

    //Parameters: (URL, Title, Position, Height, Width, Modal?, Maximized?)
    function abrirVentanaDesktop(pURL, pTitulo, pPos, pAlto, pAncho, pModal, pMaxi) 
    {
        var mWin = Ext.getCmp(pURL);
        
        if (!mWin)
        {
             var desk = obtenerDesktopBase();  //Method to get Desktop from anywhere (Window in a Window, in a iframe... modal or not)
             if (desk != undefined && desk !=null)
             {
                
                var mAncho;
                var mAlto;
                var mTitulo;
                if(pAncho == undefined)
                {
                  mAncho =  1000;
                }
                else
                {
                    mAncho = pAncho;
                }
                if(pAlto == undefined)
                {
                  mAlto =  600;
                }
                else
                {
                    mAlto = pAlto;
                }
                
                if(pTitulo == undefined)
                {
                  mTitulo =  '';
                }
                else
                {
                    mTitulo = pTitulo;
                }
                if(pModal == undefined || pModal == null)
                    pModal = false;
                else
                    pModal = true;
                
                mWin = desk.createWindow({
                    id: pURL,
                    title  : mTitulo,
                    width  : mAncho,
                    height : mAlto,
                    maximizable : true,
                    minimizable : true,
                    modal: pModal,
                    closeAction : "close",
                    loadAction: function(){if(evaluarSessionExpired(this.document.innerHTML)){refrescarVentanaBase();return;}},
                    autoLoad : {
                        url  : pURL,
                        mode : "iframe",
                        showMask : true
                    }
                    
                });
                
                if(pPos == 'center')
                    mWin.center();
             }
             
              mWin.show();
              
            if (pMaxi == 'M')     // ADDED CONTROL TO MAXIMIZE WINDOW IF NEEDED
            {
                mWin.maximize();
                }
           
            
         }  
    }
    Call from a Menu:
    <ext:MenuItem runat="server" ID="MenuItem2" Text="Categorías de contacto" HideOnClick="true" Icon="WorldEdit">
                            <Listeners >
                                <Click Handler="abrirVentanaDesktop('./CategoriaContactoListado.aspx', 'Categorías de contacto', 'center',null,null,false,'M');"/>
                            </Listeners>
                        </ext:MenuItem>

    Window maximized initially (without minimize button):

    Click image for larger version. 

Name:	Maximized.jpg 
Views:	114 
Size:	26.9 KB 
ID:	4041


    Window restored??:

    Click image for larger version. 

Name:	Restored.jpg 
Views:	125 
Size:	20.0 KB 
ID:	4042

    Thanks
    Regards
    Fernando
    Last edited by Daniil; Apr 03, 2012 at 6:59 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please try to just add
    maximized : true
    into a window config instead of calling the maximize function.
  3. #3
    Ok, better.

    Now the window shows well when restored, but there are still two problems.

    It still has no minimize button. It maximizes not at 100% height leaving a small strip of desktop at the top.

    This is the screen:

    Click image for larger version. 

Name:	Maximized2.jpg 
Views:	76 
Size:	25.1 KB 
ID:	4044

    And just in case... I paste the code as it is now:

    
    function abrirVentanaDesktop(pURL, pTitulo, pPos, pAlto, pAncho, pModal, pMaxi)
    {
        var mWin = Ext.getCmp(pURL);
        
        if (!mWin)
        {
                var desk = obtenerDesktopBase();
             if (desk != undefined && desk !=null)
             {
                
                var mAncho;
                var mAlto;
                var mTitulo;
                var mMaxi;
                if(pAncho == undefined)
                {
                  mAncho =  1000;
                }
                else
                {
                    mAncho = pAncho;
                }
                if(pAlto == undefined)
                {
                  mAlto =  600;
                }
                else
                {
                    mAlto = pAlto;
                }
                
                if(pTitulo == undefined)
                {
                  mTitulo =  '';
                }
                else
                {
                    mTitulo = pTitulo;
                }
                if (pMaxi == 'M')
                {
                    mMaxi = true;
                }
                else
                    mMaxi = false;
                    
                if(pModal == undefined || pModal == null)
                    pModal = false;
                else
                    pModal = true;
                
                mWin = desk.createWindow({
                    id: pURL,
                    title  : mTitulo,
                    width  : mAncho,
                    height : mAlto,
                    maximizable : true,
                    minimizable : true,
                    maximized: mMaxi,
                    modal: pModal,
                    closeAction : "close",
                    loadAction: function(){if(evaluarSessionExpired(this.document.innerHTML)){refrescarVentanaBase();return;}},
                    autoLoad : {
                        url  : pURL,
                        mode : "iframe",
                        showMask : true
                    }
                    
                });
                
                if(pPos == 'center')
                    mWin.center();
             }
             
              mWin.show();
         }  
    }
    Thanks
    Regards
    Fernando
  4. #4
    I was unable to reproduce the two problems. Here is my test case. Please provide your one.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
    
        }
    
        protected void TestHandler(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("TestHandler", "Hello from DirectEvent!").Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    
        <script type="text/javascript">
            var addWindow = function (app) {
                var desktop = app.getDesktop();
                    win = desktop.createWindow({
                        title       : "Window",
                        html        : "Hello!",
                        minimizable : true,
                        maximizable : true, 
                        maximized   : true,
                    });
    
                win.show();
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Desktop ID="Desktop1" runat="server" BackgroundColor="black">
            <StartMenu>
                <Items>
                    <ext:MenuItem Text="Create Window">
                        <Listeners>
                            <Click Handler="addWindow(Desktop1); this.disable();" />
                        </Listeners>
                    </ext:MenuItem>
                </Items>
            </StartMenu>
        </ext:Desktop>
    </body>
    </html>
  5. #5
    Hi

    My code is up here.

    I'll complete it with the missing called function, but there won't be too much difference.

    Your testing code differs from mine essentially because I am opening a window in iframe mode with a mask (in case that cares)

    Actual function is pasted above in previous post. (I tryied with LoadAction line commented, just in case that affected, but the same happened).

    Also the same happens in IE, Firefox and Chrome.

    Here are the missing called functions in the code above:

    function obtenerDesktopBase()
    {
         var mVentanaBase = obtenerVentanaBase();
         if(mVentanaBase != undefined && mVentanaBase != null)
         {
            var mEsc = mVentanaBase.Escritorio;    //Escritorio (Desktop in spanish) is the name I give to main desktop
            if (mEsc != undefined && mEsc != null)
            {
                var desk = mEsc.getDesktop();
                if (desk != undefined && desk !=null)
                    return desk;
            }
         }
         return null;
    }
    
    function obtenerVentanaBase()
    {
        
       var p = this.window;
        while (p = p.parent) 
            if (p == this.window.top) 
                return p;
        return undefined;
    }
    This is the pasted above actual function I call, but simplified.

    
    function abrirVentanaDesktop()
    {
        var mWin = Ext.getCmp('http://localhost/URLtoLoad.aspx');
        
        if (!mWin)
        {
              var desk = obtenerDesktopBase();  //see this function up here
             if (desk != undefined && desk !=null)
             {
                mWin = desk.createWindow({
                    id: 'http://localhost/URLtoLoad.aspx',
                    title  : 'Any title',
                    width  : 800,
                    height : 600,
                    maximizable : true,
                    minimizable : true,
                    maximized: true,
                    modal: false,
                    closeAction : 'close',
                    autoLoad : {
                        url  : 'http://localhost/URLtoLoad.aspx',
                        mode : "iframe",
                        showMask : true
                    }                
                });
                   mWin.center();
             }
              mWin.show();
         }  
    }
    Thanks
    Regards
    Fernando
    Last edited by FAS; Mar 30, 2012 at 3:38 PM. Reason: Misstyped URLtoLoad path example.
  6. #6
    Could you provide a full test sample to reproduce?
  7. #7
    Hi Daniil.

    I have built a small testing example with only the essential code I use. The error still occurs.

    I can't upload it here (only image files are accepted). How could I send it to you to test?

    Its a zip or rar file with solution, project and some files. I deleted the EXT dll from bin, so it is only 73 Kb.

    Or should I paste ALL the code here?

    Thanks
    Regards
    Fernando.
  8. #8
    Yes, please post minimal required things directly here wrapping in [CODE ] tags.

    Please place code behind (if it's required) directly on aspx page within:
    <script runat="server">
        ...
    </script>
  9. #9
    Ok, here it goes.

    There is no codebehind needed.

    Default.aspx:

    
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Test maximize window with EXT.NET</title>
        <style type="text/css">
            .start-button
            {
                background-image: url(./imgs/vista_start_button.gif) !important;
            }
            .shortcut-icon
            {
                width: 48px;
                height: 48px;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=  "./imgs/window.png" , sizingMethod= "scale" );
            }
            .icon-grid48
            {
                background-image: url(grid48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=  "./imgs/grid48x48.png" , sizingMethod= "scale" );
            }
            .icon-user48
            {
                background-image: url(user48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=  "./imgs/user48x48.png" , sizingMethod= "scale" );
            }
            .icon-window48
            {
                background-image: url(window48x48.png) !important;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=  "./imgs/window48x48.png" , sizingMethod= "scale" );
            }
            .desktopEl
            {
                position: absolute !important;
            }
        </style>
    
    
        <script type="text/javascript">
                
    //        var EventManager;
    //        function initialize() {
    //            EventManager = new EventManagerClass;
    //        }
            
            //ABRE VENTANA EN EL ESCRITORIO (EXT.NET)
            function abrirVentanaDesktop(pURL, pTitulo, pPos, pAlto, pAncho, pModal, pMaxi)
            {
                var mWin = Ext.getCmp(pURL);
                
                if (!mWin)
                {
                    var desk = obtenerDesktopBase();
                     if (desk != undefined && desk !=null)
                     {
                        
                        var mAncho;
                        var mAlto;
                        var mTitulo;
                        var mMaxi;
                        if(pAncho == undefined)
                        {
                          mAncho =  1000;
                        }
                        else
                        {
                            mAncho = pAncho;
                        }
                        if(pAlto == undefined)
                        {
                          mAlto =  600;
                        }
                        else
                        {
                            mAlto = pAlto;
                        }
                        
                        if(pTitulo == undefined)
                        {
                          mTitulo =  '';
                        }
                        else
                        {
                            mTitulo = pTitulo;
                        }
                        if (pMaxi == 'M')
                        {
                            mMaxi = true;
                        }
                        else
                            mMaxi = false;
                            
                        if(pModal == undefined || pModal == null)
                            pModal = false;
                        else
                            pModal = true;
                        
                        mWin = desk.createWindow({
                            id: pURL,
                            title  : mTitulo,
                            width  : mAncho,
                            height : mAlto,
                            maximizable : true,
                            minimizable : true,
                            maximized: mMaxi,
                            modal: pModal,
                            closeAction : "close",
                            //loadAction: function(){if(evaluarSessionExpired(this.document.innerHTML)){refrescarVentanaBase();return;}},
                            autoLoad : {
                                url  : pURL,
                                mode : "iframe",
                                showMask : true
                            }
                            
                        });
                        
                        if(pPos == 'center')
                            mWin.center();
                     }
                     
                      mWin.show();           
                }  
            }
            
            //Obtener Desktop de la ventana base (EXT.NET)
            function obtenerDesktopBase()
            {
                 var mVentanaBase = obtenerVentanaBase();
                 if(mVentanaBase != undefined && mVentanaBase != null)
                 {
                    var mEsc = mVentanaBase.Escritorio;
                    if (mEsc != undefined && mEsc != null)
                    {
                        var desk = mEsc.getDesktop();
                        if (desk != undefined && desk !=null)
                            return desk;
                    }
                 }
                 return null;
            }
            
            function obtenerVentanaBase()
            {
                
               var p = this.window;
                while (p = p.parent) 
                    if (p == this.window.top) 
                        return p;
                return undefined;
            }
    
    
           
        </script>
    
    
    </head>
    <body">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
        <form id="form1" runat="server">
        <div>
            <ext:Desktop ID="Escritorio" runat="server" BackgroundColor="Black" ShortcutTextColor="White"
                Wallpaper="./imgs/desktop.jpg">
                <StartButton Text="Inicio" IconCls="start-button" />
                <StartMenu Width="400" Height="400" ToolsWidth="227" Title="Inicio">
                   
                    <Items>
                        <ext:MenuItem ID="MenuItem1" runat="server" Text="All" Icon="Folder" HideOnClick="false">
                            <Menu>
                                <ext:Menu ID="Menu1" runat="server">
                                    <Items>
                                        <ext:MenuSeparator />
                                        <ext:MenuItem runat="server" ID="MenuItem2" Text="Maximized window" HideOnClick="true"
                                            Icon="WorldEdit">
                                            <Listeners>
                                                <Click Handler="abrirVentanaDesktop('./MaximizedWindow.aspx', 'Maximized window', 'center',null,null,false,'M');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                        <ext:MenuSeparator />
                                        <ext:MenuItem runat="server" ID="MenuItem3" Text="Normal window" HideOnClick="true"
                                            Icon="WorldEdit">
                                            <Listeners>
                                                <Click Handler="abrirVentanaDesktop('./NormalWindow.aspx', 'Normal window', 'center');" />
                                            </Listeners>
                                        </ext:MenuItem>
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:MenuItem>
                        </Items>
                </StartMenu>
            </ext:Desktop>
        </div>
        </form>
    </body>
    </html>
    MaximizedWindow.aspx (just a regular page)
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="MaximizedWindow.aspx.vb" Inherits="MaximizedWindow" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Página sin título</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            This windows should start maximized.<br />
            <br />
            Issues:<br />
            No minimize buton at toolbar.<br />
            Not full height maximized (a small strip of desktop is shown at the top)<br />
            If restored still there isn't a minimize button.<br />
            It places a Mask behind (other windows or desktop can't be focused with mouse click). Regular windows doesn't. This window can only loose focus when another window is selected from bottom bar.<br />
        </div>
        </form>
    </body>
    </html>
    NormalWindow.aspx (just a regular page)
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="NormalWindow.aspx.vb" Inherits="NormalWindow" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Página sin título</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        This is a normal window.
        It can be minimized, restored and maximized without problem.
        
        </div>
        </form>
    </body>
    </html>
    I also paste used images, just in case. Place all in imgs folder.

    EXT Dlls used versions:

    Ext.Net.dll 1.2.0.21945
    Ext.Net.Utilities.dll 1.1.0.21941
    Newtonsoft.Json.dll 3.5.0.0

    Thanks
    Regards
    Fernando
    Attached Thumbnails vista_start_button.gif   desktop.jpg  
    Last edited by FAS; Apr 03, 2012 at 4:39 PM. Reason: Typos
  10. #10
    Not full height maximized (a small strip of desktop is shown at the top)
    Please don't call
    mWin.center();
    for the maximized window.

    If restored still there isn't a minimize button.
    It places a Mask behind (other windows or desktop can't be focused with mouse click). Regular windows doesn't. This window can only loose focus when another window is selected from bottom bar.
    The following causes this behavior:
    modal : true
    Setting up:
    modal : false
    solves the problem.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Maximized window doesn't remain maximized
    By vadym.f in forum 1.x Premium Help
    Replies: 9
    Last Post: Feb 07, 2012, 4:32 PM
  2. Strange behavior with Window control
    By jlattimore in forum 1.x Help
    Replies: 1
    Last Post: May 30, 2011, 12:23 PM
  3. [CLOSED] Strange behavior of fieldset
    By 78fede78 in forum 1.x Premium Help
    Replies: 1
    Last Post: Oct 20, 2010, 12:55 PM
  4. Replies: 8
    Last Post: Jun 23, 2010, 11:16 AM
  5. How to show window maximized ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 4
    Last Post: Jun 03, 2010, 7:27 AM

Tags for this Thread

Posting Permissions