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

[Solved] "undefined" on GetLeftPosition()

9 Answers 132 Views
Window
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 07 Jan 2008, 05:23 PM
Hi,

I'm in the process of changing my "RadWindow" to the prometheus version, but have had a few problems.

My main issue was getting the top/left of the window. The GetLeftPosition() always returns undefined. I checked in the documentation and it seems theres a "getWindowBounds". The documentation however shows an example of RadWindow1.getWindowBounds().left; which doesn't work.

Is the documentation wrong, or do I need Q3 of the controls (I have 2007 Q2 at the moment)?

Is "GetLeftPostion" not available in Prometheus?

Regards

Bobby

9 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 08 Jan 2008, 08:20 AM
Hello Bobby,

Unfortunately there was a mistake in the documentation for RadWindow Prometheus Q2. The correct syntax is:

oWnd.getWindowBounds().x; oWnd.getWindowBounds().y;


The mistake is already fixed in the Q3 documentation (online version). Please accept our sincere apologies for the inconvenience.




Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 08 Jan 2008, 08:48 AM
Hi Georgi,

Thanks for the prompt reply. I've now started using the getWindowBounds method, but have come across a problem. Although the x and y properties are correct, the height and width always return the initial values.  I've also tried get_Width and GetWidth but they return the same values.

I've tried changing various properties on the window manager, but still get the same values back. Below is a sample page where resizing the radwindow always messagebox's with 300:

Regards

Bobby

<%

@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%

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

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<

script language="javascript" type="text/javascript" >

function

OnClientResize(sender, eventArgs)

{

alert(sender.get_Height());

return true;

}

</

script>

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

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientResize="OnClientResize" VisibleOnPageLoad="True" ReloadOnShow="True">

<Windows>

<telerik:RadWindow runat="server" Behavior="Default" IntialBehavior="None" Left=""

NavigateUrl="" Style="display: none;" Top="">

</telerik:RadWindow>

</Windows>

</telerik:RadWindowManager>

</div>

</form>

</

body>

</

html>

0
James
Top achievements
Rank 1
answered on 08 Jan 2008, 08:48 AM
Hi Georgi,

Thanks for the prompt reply. I've now started using the getWindowBounds method, but have come across a problem. Although the x and y properties are correct, the height and width always return the initial values.  I've also tried get_Width and GetWidth but they return the same values.

I've tried changing various properties on the window manager, but still get the same values back. Below is a sample page where resizing the radwindow always messagebox's with 300:

Regards

Bobby

<%

@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%

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

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<

script language="javascript" type="text/javascript" >

function

OnClientResize(sender, eventArgs)

{

alert(sender.get_Height());

return true;

}

</

script>

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

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientResize="OnClientResize" VisibleOnPageLoad="True" ReloadOnShow="True">

<Windows>

<telerik:RadWindow runat="server" Behavior="Default" IntialBehavior="None" Left=""

NavigateUrl="" Style="display: none;" Top="">

</telerik:RadWindow>

</Windows>

</telerik:RadWindowManager>

</div>

</form>

</

body>

</

html>

0
Georgi Tunev
Telerik team
answered on 10 Jan 2008, 01:49 PM
Hi Bobby,

sender.get_Height() will return you the initial height of the RadWindow only - this value is not changed after that.

Here is how to get all the current information about the RadWindow's bounds:
function OnClientResize(sender, eventArgs)   
{   
    var bounds = sender.getWindowBounds();  
    alert("height: " + bounds.height + "; width: " + bounds.width + "\n" + "top position: " + bounds.y + " left position: " + bounds.x);  
    return true;   

I will modify the help article as I see that indeed the explanations provided there can be misleading. Thank you for bringing this problem to my attention - your points were updated.




Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 14 Jan 2008, 03:31 PM

Hi Georgi,

Thanks for the reply.  I've tried the code you've posted, but still seem to have a problem. The width, top and left are correct, the the height never changes from the original number.

I've added the code is at the bottom of this posting.

Regards

Bobby


<%

@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%

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

<!

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

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

<

head runat="server">

<title>Untitled Page</title>

</

head>

<

body>

<

script language="javascript" type="text/javascript" >

function

OnClientResize(sender, eventArgs)

{

var bounds = sender.getWindowBounds();

alert(

"height: " + bounds.height + "; width: " + bounds.width + "\n" + "top position: " + bounds.y + " left position: " + bounds.x);

return true;

}

</

script>

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

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" OnClientResize="OnClientResize" VisibleOnPageLoad="True" ReloadOnShow="True">

<Windows>

<telerik:RadWindow runat="server" Behavior="Default" IntialBehavior="None" Left=""

NavigateUrl="" Style="display: none;" Top="">

</telerik:RadWindow>

</Windows>

</telerik:RadWindowManager>

</div>

</form>

</

body>

</

html>

0
Georgi Tunev
Telerik team
answered on 14 Jan 2008, 04:14 PM
Hello Bobby,

I have just tried your code and it is working as expected. Can you please check the attached movie and let me know if I am missing something?




Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 14 Jan 2008, 04:31 PM
Hi Georgi,

Yep, your video clip looks fine. I've just tested on another machine (Vista instead of XP) and have the same results. I have noticed however that if I shrink the window, the height changes, but not if I expand (300 seems to be the highest)

I'm downloading Q3 to see if it resolves the issue. I'll let you know if I make any progress.

One thing I did notice was in your copy of the code, "InitialBehaviour" is underlined as if an issue. My code doesn't have it underlined. Is this an obsolete property now?

Regards

Bobby
0
Georgi Tunev
Telerik team
answered on 15 Jan 2008, 09:36 AM
Hello again Bobby,

I apologize for forgetting the fact that you have the Q2 release - you mention that in your initial post. You will need to use the latest version of the RadWindow "Prometheus" control, everything will work as expected.


Once again, sorry for the omission.




Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
James
Top achievements
Rank 1
answered on 15 Jan 2008, 12:31 PM
Hi Georgi,

I've now installed Q3. I had a few issues upgrading from the old RadCombo control. The resize event on the window is now working fine, so it looks like it was fixed in Q3

Thanks for all your responses.

Regards

Bobby
Tags
Window
Asked by
James
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
James
Top achievements
Rank 1
Share this question
or