Center Window inside panel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Center Window inside panel

    Hi,

    Is there any way to center window inside the panel when page loaded? The problem is i have a HBox Layout with 2 panels (flex=1).

    I tried a window listener <AfterRender> but without success. I also attached the picture what i want to do.

    The bellow code
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <ext:ResourceManager runat="server" />
                <ext:Viewport runat="server" Layout="HBoxLayout">
                    <Items>
                        <ext:Panel runat="server" Flex="1" Title="Janela 1" Layout="FitLayout" Height="500">
                            <Items>
                                <ext:Window ID="Window1" runat="server" Flex="1" Title="Janela 1" Maximizable="true" Constrain="true">
                                </ext:Window>
                            </Items>
                        </ext:Panel>
                        <ext:Panel ID="Panel1" runat="server" Flex="1" Title="Janela 2" Layout="FitLayout" Height="500">
                            <Items>
                                <ext:Window ID="Window2" runat="server" Flex="1" Title="Janela 2" Maximizable="true" Constrain="true">
                                    <Listeners>
                                        <AfterRender Fn="SetPosition()"></AfterRender>
                                    </Listeners>
                                </ext:Window>
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:Viewport>
            </div>
        </form>
    </body>
    </html>
    
    <script type="text/javascript">
        function SetPosition() {
            var y = Ext.get('Window2');
            y.setX(400);
        }
    
    
    </script>
    Attached Thumbnails window.jpg  

Similar Threads

  1. [CLOSED] Center window to Panel or Grid
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 26, 2012, 10:39 PM
  2. Replies: 2
    Last Post: Jun 23, 2012, 2:17 PM
  3. Center a panel inside another panel
    By PAOLO in forum 1.x Help
    Replies: 0
    Last Post: Oct 03, 2011, 3:44 PM
  4. [CLOSED] Center GridPanel inside a Panel
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 01, 2009, 5:48 PM
  5. grid panel inside a window
    By [WP]joju in forum 1.x Help
    Replies: 4
    Last Post: Feb 09, 2009, 6:11 AM

Tags for this Thread

Posting Permissions