CetContentWidth() will return the width of the non-dynapi (read-HTML)
content in a alayer.
Regardless of the width of the layer itself.
----- Original Message -----
From: "Hershel Robinson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 16, 2001 6:39 AM
Subject: Re: [Dynapi-Help] getContentWidth() Question


> > have you added the layer to a parent yet?  if not, it hasn't actually
been
> > created and will not have a content height.
>
> I wrote that I can see the setHTML working, so that would probably
indicate
> that it has been added to a parent.
>
> > This " the same" value, is it the size of the 'invite' layer, it is
always
> 0,
> > is it some random number that has no apparent relationship with the size
> of the
> > layer and the size of the content ?
>
> The initial width is set to 405.  The value I keep seeing is 415.  This
> would appear to be because I am putting in a text which is 415 wide.  I
did
> just notice, however, that if myText is very wide, I will see a number
> larger than 415, although 415 is actually the width of the DynLayer
itself.
> This may sound strange.  Here is a bit more of my code:
>
> ////////////////////////
> // updateInvite
> ////////////////////////
> function updateInvite() {
>     var myText = formLayer.doc.TextForm.InviteText.value
>     re = /\r\n/g;
>     myText = myText.replace(re, "<BR>");
>     oldText = invite.textLayer.getHTML()
>     var fontselindex = formLayer.doc.TextForm.Font.selectedIndex
>     var sizeselindex = formLayer.doc.TextForm.Size.selectedIndex
>     var colorselindex = formLayer.doc.TextForm.Color.selectedIndex
>     var myText = "<B><FONT
> FACE='"+formLayer.doc.TextForm.Font[fontselindex].value+"' "+
>                  "SIZE="+formLayer.doc.TextForm.Size[sizeselindex].value+"
> "+
>
> "COLOR=#"+formLayer.doc.TextForm.Color[colorselindex].value+">"+
>                  myText+"<BR><BR>" +
>                  "Time: "+formLayer.doc.TextForm.Time.value+"<BR>"+
>                  "Place: "+formLayer.doc.TextForm.Place.value+"<BR>"+
>                  "Location:
"+formLayer.doc.TextForm.Location.value+"<BR>"+
>                  "Date: "+formLayer.doc.TextForm.Date.value+"<BR>"
>
>     invite.textLayer.setHTML("<CENTER>"+
>                              myText+
>                              "</CENTER>")
>
> alert("width = "+invite.textLayer.getContentWidth()+" and size =
> "+(inviteWidth-invite.lMargin-invite.rMargin))
>
> alert(invite.textLayer.getWidth())
>
>     if (invite.textLayer.getContentHeight() >
>         inviteHeight-invite.tMargin-invite.bMargin) {
>           invite.textLayer.setHTML(oldText)
>           alert("Sorry, your message is too tall for this invitation.")
>     }
>     else if (invite.textLayer.getContentWidth() >
>         inviteWidth-invite.lMargin-invite.rMargin) {
>         invite.textLayer.setHTML(oldText)
>         alert("Sorry, your message is too wide for this invitation.")
>     }
>     else {
>
> invite.textLayer.setHeight(inviteHeight-invite.tMargin-invite.bMargin)
>
invite.textLayer.setWidth(inviteWidth-invite.lMargin-invite.lMargin)
>         invite.textLayer.moveTo(invite.lMargin,
>
>
(inviteHeight-invite.bMargin-invite.tMargin-invite.textLayer.getContentHeigh
> t())/2)
>     }
> }
>
> The page is actually online at: http://65.108.142.83/NEWeinvites.htm  If
you
> want to see your text actually work, use the upper left image (the rose)
> because it's the widest.
>
> The two alerts in the code are obviously just my debugging technique.
>
> Thanks,
> Hershel
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>


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

Reply via email to