From: <ml...@id...> - 2003-08-13 21:16:16
|
I have the following test case. What I want to do is determine the size of a template object after I fill in the field values. This needs to work, after the template has been added to the document. It doesn't appear to for some reason. Relevant code: the width value never changes even after I add the child field var body = 'I am a simply layer, what is my size, oldWidth is my size before we fill in a template field, newWidth is the size afterwards. {@field}'; var sizeTemplate = new Template(body); dynapi.document.addChild(sizeTemplate); var oldWidth = sizeTemplate.getWidth(); var oldContentWidth = sizeTemplate.getContentWidth(); sizeTemplate.addChild(new DynLayer('hello'),'field'); sizeTemplate.setLocation( 0, 100 ); sizeTemplate.setBgColor( '#FFFFFF' ); var newWidth = sizeTemplate.getWidth(); var newContentWidth = sizeTemplate.getContentWidth(); var wLayer; if( oldWidth == newWidth ) { wLayer = new DynLayer( 'oldWidth == newWidth = ' + sizeTemplate.getWidth() ); } else { wLayer = new DynLayer( 'oldWidth(' + oldWidth + ') != newWidth(' + sizeTemplate.getWidth() + ')' ); } wLayer.setLocation( 0, 200 ); dynapi.document.addChild( wLayer ); wLayer.setBgColor( '#FFFFFF' ); var cLayer if( oldContentWidth == newContentWidth ) { cLayer = new DynLayer( 'oldContentWidth == newContentWidth = ' + sizeTemplate.getContentWidth() ); } else { cwLayer = new DynLayer( 'oldContentWidth(' + oldContentWidth + ') != newContentWidth(' + sizeTemplate.getContentWidth() + ')' ); } cLayer.setLocation( 0, 300 ); dynapi.document.addChild( cLayer ); cLayer.setBgColor( '#FFFFFF' ); #text/html; name="mysize.html" [Test file] /tmp/mysize.html |