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

Raddock jumps 4 pixels up and left on click

1 Answer 40 Views
Dock
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 17 Sep 2008, 11:42 AM
I have encountered a problem with the RadDock control when it is used inside an IFRAME with the frameborder property set to 0.

I have a simple page (raddocktest.aspx) which just creates a draggable Raddock and puts it on the page. This works fine, and you can click on the RadDock title and drag it around.

However, if I include this page within an IFRAME in another page (johnmaster.aspx) then I get a problem (only when using IE7, it is fine in firefox). If I set the frameborder property of the iframe to 0 then the raddock jumps slightly when I click on the title bar. It moves up and left by about 4 pixels. This does not happen when I set the frameborder to 1, but I don't want a frame border. It also moves about 2 extra pixels at the end of the drag when it is dropped.

I have included here the source of the raddocktest.aspx page and the page with the iframe that it sits in.

Any ideas what I can do to stop this happening? I makes it very annoying to drag/drop the raddock when it keeps jumping a few pixels each time.


johnmaster.aspx

<%

@ Page Language="VB" AutoEventWireup="false" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>demo</title>

</

head>

<

body >

<form id="frmMaster" runat="server">

<iframe id="MainFrame" src="raddocktest.aspx" height="700" frameborder=0 width="500" scrolling="no" >

</iframe>

</form>

</

body>

</

html>

RADDOCKTEST.ASPX

<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="raddocktest.aspx.vb" Inherits="raddocktest" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

html xmlns="http://www.w3.org/1999/xhtml" >

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<form id="form1" runat="server">

<div>

<asp:Panel runat=server ID="MainArea"></asp:Panel>

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">

</telerik:RadScriptManager>

</div>

</form>

</

body>

</

html>

RADDOCKTEST.aspx.vb

Imports

Telerik.Web.UI

Partial

Class raddocktest

Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim Raddock As New RadDock

Raddock.Width = 200

Raddock.Height = 100

Raddock.Top = 200

Raddock.Left = 200

Raddock.Title =

"hello"

Raddock.ID =

"MYRADDOCK"

MainArea.Controls.Add(Raddock)

End Sub

End

Class


1 Answer, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 18 Sep 2008, 11:58 AM
Hi John,

Thank you for your feedback.
The scenario you describe is specific and the problem you experience is result of the Microsoft getLocation method we use for calculating the dock location. In the setup you describe the location is not correctly calculated and that is why wrong coordinates are set to the RadDock. We will log this issue for further consideration and investigation. For the time being you can handle the OnClientDragStart and the OnClientDragEnd events of the dock and add the needed number of pixels to the dock's location in this specific scenario, e.g.:
function resetDockPos(sender, args)  
{  
    if(Sys.Browser.agent == Sys.Browser.InternetExplorer)  
    {  
        var element = sender.get_element();  
        var inFrame = false;  
        try {  
            inFrame = element.ownerDocument.parentWindow.frameElement;  
        } catch(ex) {  
            // If accessing the frameElement fails, a frame is probably in a different  
            // domain than its parent - and we still want to do the calculation below  
            inFrame = true;  
        }  
        if (inFrame || $telerik.isIE6) {  
            var location = sender._getLocation();  
            sender.set_left(location.x + 4);  
            sender.set_top(location.y + 4);  
        }  
    }  
For your convenience I have attached a modified version of your test pages.
If you need further assistance, do contact us again.

Best wishes,
Sophy
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Dock
Asked by
john
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Share this question
or