[CLOSED] Show Window Centered in screen

  1. #1

    [CLOSED] Show Window Centered in screen

    Hi, I have a page with multiple buttons that show a Window, the problem is that all those buttons are in a different Y possition, so i would like to show the window centered in the screen (not in the page).

    I have something like this:
    (Buttons in my page are created dynamically)
    <body>
    <form runat="server">
    
        <ext:ResourceManager runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="columnlayout" AutoScroll="true" >
            <Items>
                    <ext:Panel runat="server" id="panel1" ColumnWidth="1" Height="2000" Frame="true">
                        <Items>
                            <ext:Button runat="server" ID="button" Text="Show Window" Y="300">
                                <DirectEvents>
                                    <Click OnEvent="ShowWindow"></Click>
                                </DirectEvents>
                            </ext:Button>
    
                            <ext:Button runat="server" ID="button2" Text="Show Window" Y="600">
                                <DirectEvents>
                                    <Click OnEvent="ShowWindow"></Click>
                                </DirectEvents>
                            </ext:Button>
    
                            <ext:Button runat="server" ID="button1" Text="Show Window" Y="1200">
                                <DirectEvents>
                                    <Click OnEvent="ShowWindow"></Click>
                                </DirectEvents>
                            </ext:Button>
    
                            <ext:Button runat="server" ID="button3" Text="Show Window" Y="1500">
                                <DirectEvents>
                                    <Click OnEvent="ShowWindow"></Click>
                                </DirectEvents>
                            </ext:Button>
    
                            <ext:Button runat="server" ID="button4" Text="Show Window" Y="2000">
                                <DirectEvents>
                                    <Click OnEvent="ShowWindow"></Click>
                                </DirectEvents>
                            </ext:Button>
                            
                        </Items>
                    </ext:Panel>
            </Items>
        </ext:Viewport>
        <ext:Window runat="server" Closable="true" ID="win1" Hidden="true" height="600">
            <Items>
                   <ext:Panel runat="server">
                       <Items>
                           <ext:Label runat="server" Text="hello"></ext:Label>
                       </Items>
                   </ext:Panel>
            </Items>
        </ext:Window>
           
    
    </form>
    </body>
    protected void ShowWindow(object sender, EventArgs e)
            {
                win1.Hidden = false;
                win1.Show();
            }
    I have tried to get the Y position of the button and use it on the window, but if the botton is at the lower of the page, the window gets "cutted.

    ¿Is there any way to center the window in the visual side of the page?
    Last edited by fabricio.murta; Feb 26, 2018 at 9:34 PM.
  2. #2
    Hi,

    I was able to center the Window in the viewport by calling the .Center() method on the Window instance.

    Example

    protected void ShowWindow(object sender, EventArgs e){
        win1.Hidden = false;
        win1.Center();
        win1.Show();
    }
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3
    Hello @PascuV!

    It's been a while since we replied your inquiry and still no word from you. Did the solution presented work for you? Do you still need assistance in this issue?

    If you do not reply to this message in 7+ days from now, we may mark this thread as closed, but that won't prevent you from posting follow-ups and reopening it whenever you feel more convenient.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Hi Fabricio, It worked, but not as I expected so I found another solution. I keep the "Y" coordinate of the button and I use It in the window.

    You can mark this thread as closed. Thank You!
  5. #5
    Hello @PascuV!

    Thanks for the feedback, and also for sharing the solution that suited best your needs, we will be marking the thread as closed, then.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. put ext:Window in center of the screen
    By Holly in forum 2.x Help
    Replies: 2
    Last Post: Nov 07, 2013, 12:33 PM
  2. Replies: 1
    Last Post: Oct 21, 2013, 1:54 AM
  3. [CLOSED] Ext Window not always centering in screen
    By wisdomchuck in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 29, 2012, 6:50 PM
  4. Replies: 3
    Last Post: Mar 19, 2012, 12:35 PM
  5. Loading screen during window resize
    By adipoaca in forum 1.x Help
    Replies: 1
    Last Post: Nov 24, 2011, 12:39 PM

Tags for this Thread

Posting Permissions