It is impossible to know the content's size before adding the layer to the
document ( which can be done by adding the layer to the doc or to a layer that
is added to the doc ). Before adding a dynLayer to the doc you only have a
DynLayer object and a string containing some HTML. Once the dynalyer is added, a
physical, browser-specific layer is created and its content set. At this point
the browser renders the html (either this or crashes) and from this point on,
since the browser has already drawn your content, you can retrieve its size.

Regarding the described bugs, again I can't run NS6 but I remember some post
saying that it could be fixed by using the setTimeout trick.

Matthew Shirey wrote:

> Hey all,
>
> New problem.  Actually I think it's an old problem but I have not seen a
> solution yet.  getHeight and getWidth.  How do you make them work on NS 6
> and IE 5(Mac) ?
>
> Here's the code segment I am using:
>
> c = new DynLayer();
> c.moveTo(100, 100);
> c.setBgColor('#c0c0c0');
> c.setHTML("Testing!");
>
> w = c.getWidth();
> h = c.getHeight();
>
> alert("Before Add: " + w + ", " + h);
>
> DynAPI.document.addChild(c);
>
> w = c.getWidth();
> h = c.getHeight();
> alert("After Add: " + w + ", " + h);
>
> and here is what I get:
>
> IE 4.0 PC:
> Before: null, null
> After: 48, 19
>
> IE 5.0 PC:
> Before: null, null
> After: 48, 19
>
> IE 5.5 PC:
> Before: null, null
> After: 48, 19
>
> NS 4.75 PC:
> Before: null, null
> After: 48, 19
>
> NS 6 PC&Mac
> Before: null, null
> After: 0, 0
>
> IE 5 Mac
> Before: null, null
> After: 0, 0
>
> I can live with getting the values after addChild.  Means doing things a
> little weird but I can do it.  My problem is that the last two report 0s.
> This is not good.  I only need one of two things to make DynAPI usable to my
> department.  I need to be able to return the size sometime after setHTML()
> or I need to be able to use Inline layers on the platforms listed above.
> Both would make extremely happy.  95% of my content is dynamically pulled
> from a database so I have no idea what the sizes are.  Currently both of the
> methods that I could use to solve this problem don't work on all of the
> platforms I need to support.  My main two browser problems are NS 6 and IE
> 5(Mac).  Inline layers work on IE 5(Mac) but not NS 6.  Returning the size
> after setHTML() fails on both.  If anyone has workarounds/fixes to these
> problems, please let us know.
>
> -- Matthew Shirey
>
> PS.
>
> I have been going through the codebase line by line and I simply do not find
> some of the parts that I am looking for.  I still have not found where
> DynAPI.document.all has been defined.  Any information on the inner workings
> of the API would be greatly appreciated.  Some kind of object diagram would
> simply make us glow.  I am trying to construct one now to help make some
> sense of this thing.  Any information on the structure of DynAPI and/or the
> order of execution during initialization would be most helpful.
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/mailman/listinfo/dynapi-help


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/dynapi-help

Reply via email to