Getting Top/Left in OnClientDragEnd

13 posts, 0 answers
  1. James
    James avatar
    60 posts
    Member since:
    Sep 2007

    Posted 22 Jan 2008 Link to this post

    Hi,

    I'm looking into the OnClientDragEnd event of the radWindow control. I want to get the window to simulate a snap to grid. in the event, I've tried the using the following:

    - sender.getWindowBounds().x
    - sender.get_Left()

    Both always return the position of the window before the drag. i've looked at the online demo, but it doesn't look at the co-ordinates. Is there another property I need to look at for the dropped left/top?

    BTW: on the bottom of the screen for the demo, it mentions 2 parameters expected, but says "sender" is the tooltip, not RadWindow.

    Regards

    Bobby
  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 22 Jan 2008 Link to this post

    Hi Bobby,

    You are correct, and we will be investigating why the old value is returned at the point of OnClientDragEnd.
    For the time being using a window.setTimeout will solve the problem for you:

    function OnClientDragEnd(sender, args)
    {
        window.setTimeout(
    function()
        {
            alert(sender.getWindowBounds().x);
        }, 0);
    }

    Thank you for pointing the issue to our attention.

    Kind regards,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 07 Jul 2008 Link to this post

    Hi,

    I tried using the window.setTimeout mentioned, but I still get the coordinates of the window from before the drag.

    Any help would be appreciated.
  5. James
    James avatar
    60 posts
    Member since:
    Sep 2007

    Posted 08 Jul 2008 Link to this post

    Hi Peter,

    Mine seems to be working find with the latest version of the Telerik controls. Could you possibly post your code for the event handler and I'll compare it with mine?

    Regards

    Bobby
  6. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 08 Jul 2008 Link to this post

    Hi Peter,

    If you still experience problems, can you please send us a project where this behavior can be reproduced? We will check it right away,



    Kind regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 08 Jul 2008 Link to this post

    function SaveState(sender, eventArgs)  
    {  
        var bounds = sender.getWindowBounds();  
                  
        window.setTimeout(function() {  
               clientSaveState.PerformCallback(sender.get_name() + "|" + bounds.x + "|" + bounds.y + "|" + bounds.height + "|" + bounds.width + "|" + sender.isClosed());  
        }, 0);  
    }  
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Mac"   
            VisibleStatusbar="False" VisibleOnPageLoad="True"   
            onclientclose="SaveState" onclientdragend="SaveState"   
            onclientresize="SaveState" MinimizeZoneID="pnlMinimize">  
        </telerik:RadWindowManager> 
     

    I am running the latest version and this script still returns the previous location.  Any help is appreciated.
  8. James
    James avatar
    60 posts
    Member since:
    Sep 2007

    Posted 09 Jul 2008 Link to this post

    Hi Peter

    I've noticed you're doing your getwindowbounds outside of the timeout function. I'm guessing this will still retrieve the old values. I've got mine inside the settimeout function so it'll probably get fired on another thread and get the correct value (e.g. below for yours):

    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);  
    }  
  9. Peter
    Peter avatar
    22 posts
    Member since:
    Nov 2007

    Posted 09 Jul 2008 Link to this post

    Bobby,

    That was it!  It's always something simple you overlook.  Thanks for the help.

    -Peter
  10. stoneym
    stoneym avatar
    6 posts
    Member since:
    Jul 2012

    Posted 29 Jun 2010 Link to this post

    I am glad to find a workaround, but this is still happening in 2010.1.415.40

    Any plans to correct the issue?

    Thanks.
  11. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 01 Jul 2010 Link to this post

    Hello stoneym,

    Yes, we will improve this in the future but for now I cannot give a exact timeframe because such change is not an easy task due to backward compatibility. For the time being I suggest either to use the timeout or Telerik's static client library to get the needed data.


    Best wishes,
    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
  12. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 04 Aug 2011 Link to this post

    Found this in the latest version, still.  Would be nice to get fixed!
  13. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 05 Aug 2011 Link to this post

    Hi Barry,

    Thank you for bringing this to our attention. This feature has been implemented and the desired functionality will be available in the next internal build which is scheduled for the beginning of the next week, hopefully Tuesday. It will also be available in the official release since Q2 2011 SP1 (which is scheduled for mid September) as well if you do not wish to use internal builds.


    Kind regards,
    Marin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  14. LeBear
    LeBear avatar
    233 posts
    Member since:
    May 2006

    Posted 05 Aug 2011 Link to this post

    Thank you.

    I have the timeout workaround in place.  I'm not sure I would be permitted to use a preliminary build, so I'll wait until it's in a full release.  This code is currently in a prototype solution.  When I do the "real thing", I'll be happy to rely on this fix.

    Thanks.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017