PDA

View Full Version : iframe does not stay in its parent view on moving it


MBachstein
06-26-2009, 06:37 AM
Hello,

I have an iframe embedded in a window.

When I move the window, the iframe doesn't follow its parent view but stays at the same position.

On resizing the window the iframe fits to its parent view again.

Does anybody know how I can force the iframe to stay in its parent view?

Kind Regards,
Marc


<canvas>
<window x="350" y="100"
resizable="true" closeable="false" allowdrag="true" bgcolor="#BBBBBB"
minheight="200" minwidth="350" width="450" height="300">
<tabs name="myTABS" width="${parent.width}" height="${parent.height}">
<html id="myHTMLID" name="myHTML" visible="false" width="${parent.width-20}" height="${parent.height-40}" >
</html>
</tabs>
<handler name="onx">
// forcing the iframe to stay in its parent view
if (myHTMLID!=null) {
myHTMLID.setAttribute("x",0);
myHTMLID.setAttribute("y",0);
}
</handler>
</window>

<method name="_setIframeContent" args="iframeID, content, backgroundColor" ><![CDATA[
LzBrowserService.LzBrowser.callJS("window.__seticontent", false, iframeID, content, backgroundColor);
]]>
</method>

<handler name="oninit"><![CDATA[
var js = "window.__seticontent = function (iframeID, content, bgcolor) {" +
"var iframebody = document.getElementById(iframeID).contentWindow.do cument.body;" +
"iframebody.innerHTML = content;" +
"iframebody.style.backgroundColor = bgcolor; }";
if ($dhtml) {
//LPP-6911
eval(js);
} else {
LzBrowserService.LzBrowser.loadJS(js);
}
]]>
</handler>

<button name="displayHTML" text="display HTML">
<handler name="onclick"><![CDATA[
myHTMLID.setAttribute("visible",true);
var htmlContent="<html><body>abcdefg<br>E<br>S<br>T<br>T<br>E<br>ST<br>T<br>E<br>S<br>T<br>T<br>E<br>S<br>T<br>T<br>ESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTES TTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST </body></html>";

// fill myHTMLID with content
var theiframeID = myHTMLID.iframeid;
parent._setIframeContent(theiframeID, htmlContent,"blue");
]]>
</handler>
</button>
</canvas>

anil
06-29-2009, 02:45 AM
Hi,

i just remove the "tabs" section, then it works fine for me.

<window x="350" y="100"
resizable="true" closeable="false" allowdrag="true" bgcolor="#BBBBBB"
minheight="200" minwidth="350" width="450" height="300">
<!--tabs name="myTABS" width="${parent.width}" height="${parent.height}"-->
<html id="myHTMLID" name="myHTML" visible="false" width="${parent.width-20}" height="${parent.height-40}" >
</html>
<!--/tabs-->
<handler name="onx">
// forcing the iframe to stay in its parent view
if (myHTMLID!=null) {
myHTMLID.setAttribute("x",0);
myHTMLID.setAttribute("y",0);
}
</handler>
</window>

Thank you,
Anil Kumar