This is a migrated thread and some comments may be shown as answers.

Getting Top/Left in OnClientDragEnd

12 Answers 106 Views
Window
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 22 Jan 2008, 03:15 PM
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

12 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 22 Jan 2008, 03:30 PM
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
0
Peter
Top achievements
Rank 2
answered on 07 Jul 2008, 10:25 PM
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.
0
James
Top achievements
Rank 1
answered on 08 Jul 2008, 07:28 AM
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
0
Georgi Tunev
Telerik team
answered on 08 Jul 2008, 10:54 AM
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
0
Peter
Top achievements
Rank 2
answered on 08 Jul 2008, 04:47 PM
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.
0
James
Top achievements
Rank 1
answered on 09 Jul 2008, 07:27 AM
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);  
}  
0
Peter
Top achievements
Rank 2
answered on 09 Jul 2008, 02:45 PM
Bobby,

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

-Peter
0
stoneym
Top achievements
Rank 1
answered on 29 Jun 2010, 09:18 PM
I am glad to find a workaround, but this is still happening in 2010.1.415.40

Any plans to correct the issue?

Thanks.
0
Georgi Tunev
Telerik team
answered on 01 Jul 2010, 11:26 AM
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
0
LeBear
Top achievements
Rank 1
answered on 04 Aug 2011, 08:28 PM
Found this in the latest version, still.  Would be nice to get fixed!
0
Marin Bratanov
Telerik team
answered on 05 Aug 2011, 04:08 PM
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.

0
LeBear
Top achievements
Rank 1
answered on 05 Aug 2011, 05:08 PM
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.
Tags
Window
Asked by
James
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Peter
Top achievements
Rank 2
James
Top achievements
Rank 1
Georgi Tunev
Telerik team
stoneym
Top achievements
Rank 1
LeBear
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or