Copy link to clipboard
Copied
Hi Folks
I'm trying to resize a CFWindow via Javascript when the Window is loaded (according to the size of the image, i'm displaying inside). It doesn't work and I spent hours of searching by now...
Here's my simplified version:
-------------------------------------------------------------------------------
"test.cfm"
-------------------------------------------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
/* <![CDATA[ */
showWindow = function(){
ColdFusion.navigate('window-content.cfm', 'dummyWindow');
var objWindow = ColdFusion.Window.getWindowObject('dummyWindow');
if (objWindow.x < 0)
objWindow.x = 270;
if (objWindow.y < 0)
objWindow.y = 210;
objWindow.title = 'derp';
ColdFusion.Window.show('dummyWindow');
}
resizeWindow = function(imgWidth,imgHeight){
var objWindow = ColdFusion.Window.getWindowObject('dummyWindow');
objWindow.height = imgHeight;
objWindow.width = imgWidth;
}
/* ]]> */
</script>
</head>
<body>
<cfoutput>
<h2>Test</h2>
<cfwindow name="dummyWindow" width="100" height="100" resizable="true" modal="true" />
<a href="javascript:showWindow();">Show window</a>
</cfoutput>
</body>
</html>
-------------------------------------------------------------------------------
And...
-------------------------------------------------------------------------------
"window-content.cfm"
-------------------------------------------------------------------------------
<cfoutput>
<!--- I want the window to have the image's size. I can read that with CFIMAGE --->
<img src="dummy image" width="500" height="240" />
<!--- Make cfsavecontent, because you can't use ajaxOnLoad() with arguments. --->
<cfsavecontent variable="resizeHeadCont">
<script type="text/javascript">
/* <![CDATA[ */
// let's pretend, i got 500 and 240 with cffile, action=read
resizeWindow(500,240);
alert('Code block is being executed, but no cfwindow-resize happened...');
/* ]]> */
</script>
</cfsavecontent>
<cfhtmlhead text="#resizeHeadCont#" />
</cfoutput>
-------------------------------------------------------------------------------
Does anyone know, why I can't set width and height of the window after it is shown for the first time? Shouldn't be that difficult to show an Image inside a CFWindow(?) But maybe I'm completely wrong after a long day of working.
I'm using CF9 Developer Edition on Windows 7 Ultimate 64-bit with IIS7.
Thanks for reading and maybe answering
Cheers
Boris
Copy link to clipboard
Copied
Seriously... It works with:
objAWMapWin
.setSize(imgWidth, imgHeight);
It used to be setContentSize on CF8 and I'm using CF9 and I didn't get that one...