getWindowBounds, setSize and moveTo

2 posts, 0 answers
  1. neebs
    neebs avatar
    106 posts
    Member since:
    Apr 2007

    Posted 24 Jan 2010 Link to this post

    I am using getWindowbounds to obtain the position of a RadWindow after a drag event, and saving that in a cookie. Then, if they close the RadWindow and later re-open it, I am using setSize and moveTo to reposition it. The code appears as follows:

                    function WindowMoved(sender, args) { 
                        window.setTimeout(function() { 
                            SaveSizeAndPosition(sender, args); 
                        }, 10); 
                    function SaveSizeAndPosition(sender, args) { 
                        var oWnd = $find("<%= RadWindowRealMcCoy.ClientID %>"); 
                        if (oWnd != undefined) { 
                            createCookie('RealMcCoyManagerWindowTop', oWnd.getWindowBounds().y, 365); 
                            createCookie('RealMcCoyManagerWindowLeft', oWnd.getWindowBounds().x, 365); 
                            createCookie('RealMcCoyManagerWindowHeight', oWnd.getWindowBounds().height, 365); 
                            createCookie('RealMcCoyManagerWindowWidth', oWnd.getWindowBounds().width, 365); 
                    function ShowDialog() { 
                        var oWnd = $find("<%= RadWindowRealMcCoy.ClientID %>"); 
                        if ((oWnd != null) && (oWnd != undefined)) { 
                            var x = readCookie('RealMcCoyManagerWindowLeft'); 
                            var y = readCookie('RealMcCoyManagerWindowTop'); 
                            var height = readCookie('RealMcCoyManagerWindowHeight'); 
                            var width = readCookie('RealMcCoyManagerWindowWidth'); 
                            if (x) { 
                                if (oWnd._firstShow == undefined) { 
                                    oWnd.setSize(width, height); 
                                    oWnd.moveTo(x, y); 

    It appears that the result of this is a window that is slightly offset from where it should be. See the two images below, the first is after moving the window, and the second is after re-opening it.

  2. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 25 Jan 2010 Link to this post

    Hello neebs,

    The code that you posted looks OK and is working as expected on my side. Just for testing purposes, try calling moveTo() with a small timeout and if this doesn't help, please open a support ticket and send a sample project that can be run locally and reproduces the problem. We will check it and do our best to help.

    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top