Hi,
Let me see if I can explain what's on:
DynAPI.onLoad(init);
function init() {
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. [EMAIL PROTECTED]';
var sizeTemplate = new Template(body);
dynapi.document.addChild(sizeTemplate);
// ^ At this point sizeTemplate is created and given
a
// width and a height. This is by design. if no
height or width
// was specified then DynAPI will assign a height and
a width to
// the layer once it's created.
sizeTemplate.addChild(new DynLayer('hello'),'field');
sizeTemplate.generate();
// ^ At this point the DynLayer is added to the
templated but
// due to text wrapping you'll not see the word
"hello"
// to see the new layer modify your code above to
reflect:
// var sizeTemplate = new
Template(body,null,null,null,50);
The problem you're having is that once the he Template
gets a width assigned to it, it will start text
wrapping. That's why you are not able to see the
'hello' layer or get a different width. The
getContentHeight() function should however reflect a
new height.
Notes. If you call getWidth() on a layer that you did
specify a width for you'll get a 0 or null value.
--
Raymond Irving
--- [EMAIL PROTECTED] wrote:
> I originally had my size check in the onload
> function. Then I moved it
> to the body as I miss-understood Raymond's response.
>
> This test file has the code back in the onload/init
> function per
> Raymond's last message. The behavior is the same.
>
>
>
---------------------------------
GetWidth & GetContentWidth test page
dynapi.library.setPath('dynapi3x/src/')
dynapi.library.include('dynapi.library');
dynapi.library.include('dynapi.api');
dynapi.library.include('TemplateManager');DynAPI.onLoad(init);function
init() { 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. [EMAIL PROTECTED]'; var
sizeTemplate = new Template(body);
dynapi.document.addChild(sizeTemplate); var oldWidth
= sizeTemplate.getWidth(); var oldContentWidth =
sizeTemplate.getContentWidth();
sizeTemplate.addChild(new DynLayer('hello'),'field');
sizeTemplate.generate(); 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'
);}dynapi.document.insertAllChildren();Simple page to
try to demonstrate issues with the getWidth
andgetContentWidth in dynapi3
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help