how to get the current position of radwindow

4 posts, 0 answers
  1. yao wang
    yao wang avatar
    25 posts
    Member since:
    May 2010

    Posted 11 May 2010 Link to this post

    If I want to get the current position of radwindows, which could be draged and droped anywhere in the window , I add the onclientdragend in radwindowmanager like following.

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Mac"   
            VisibleStatusbar="False" VisibleOnPageLoad="True"   
            onclientdragend="SaveState"   >
        </telerik:RadWindowManager> 

    then I implenent the savestate function as following.
    function SaveState(sender, eventArgs)  
    {
                  
        window.setTimeout(function() {  
        var bounds = sender.getWindowBounds();  
        clientSaveState.PerformCallback(sender.get_name() + "|" + bounds.x + "|" + bounds.y + "|" + bounds.height + "|" + bounds.width + "|" + sender.isClosed());  
        }, 0);  
    }  

    My question is how to write the   clientSaveState.PerformCallback ? how does every radwindow under the radwindow manager update its bounds.x and bounds.y immediately after moving?

    Thanks
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 12 May 2010 Link to this post

    Hi yao wang,

    To get all RadWindows, you should use RadWindowManager's GetWindows() method. Once you have a reference to that Windows object, you can loop trough the windows and get their properties. Since you will be using a FOR cycle, I would suggest not to use getWindowsBounds() with a timeout, but Telerik's static client library for that purpose.

    For convenience I attached a small sample that shows how to get the properties of every RadWindow on a given page (assuming that they are all opened via the same RadWindowManager).


    All the best,
    Georgi Tunev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Vincent
    Vincent avatar
    24 posts
    Member since:
    Oct 2008

    Posted 27 May 2010 Link to this post

    Hi, Georgi ,

    I noticed that from the code in your attached sample solution, when you do "$telerik.getBounds(win.get_popupElement())" , it returns the absolute bounds.

    But in my scenario, I have a RestrictionZone attached to my RadWindowManager.
    How would I get the relative bounds then?

    Please advise. Thanks.

    Vincent
  4. Vincent
    Vincent avatar
    24 posts
    Member since:
    Oct 2008

    Posted 28 May 2010 Link to this post

    Got it. It's simply "win.getWindowBounds();"

    Vincent
Back to Top