setting fld with HTML: "<H3>Title</H3>" results in added empty lines

Bill Marriott wjm at wjm.org
Thu May 21 16:22:43 EDT 2009


Mark,

The problem you're running into is that the "htmlText" is not truly HTML, 
and the <H3> tag is not supported. If you inspect the contents of the 
htmlText after your script executes you'll see:

<p><font size="18"><b>This is the title</b></font></p>

The <H3> tag is nowhere to be seen.

So what is happening is that the <h3> tag is being transformed from a 
structural tag (identifying a heading and letting the browser/style sheet 
determine how it appears) into a formatting tag that Rev understands. Rev 
pretty much assumes than an <H3> heading should look something like that.

This is handy when you're dropping the contents of a web page into a field; 
but when you're working scripting and using the htmlText to format things 
you'll want to strictly limit yourself to the supported tags so you do not 
have unexpected results like this.

This behavior and the supported tags are described in the dictionary entry 
for htmlText.

- Bill


"mfstuart" <mfstuart at cox.net> wrote in message 
news:23659327.post at talk.nabble.com...
>
> Hi all,
> (hopefully, the html tags I'm using in this message don't get lost in
> transit)
>
> Here goes:
> When I use the following script to populate a field, the first 2 lines
> before the "<H3>" text and the line after the "</H3>" text are empty.
> What's up with that?
>
> ##
> on mouseUp
>   put "<H3>This is the title</H3>" into tText
>   put "This is the second line" after tText
>   set the htmlText of fld 1 to tText
> end mouseUp
> ##
>
> To clean the field up after the above script, I use the following:
> delete line 1 to 2 of fld 1  --removes first 2 blank lines
> delete line 2 to 2 of fld 1  --removes blank line after "<H3>" text
>
> I've set the properties of the field to the following:
> textHeight = 17
> fixedLineHeight = unchecked (false)
> These help to better proportion the text height with using the "<H3>" 
> tags.
>
> Q: so why would RunRev put these blank lines in using the "set htmlText"
> command?
> It seems setting the field property is enough to set the style of the 
> field
> correctly.
>
> Q: anyone got a better idea how to handle using "<H3>" text, without blank
> lines?
>
> --
> Regards,
> Mark Stuart






More information about the use-livecode mailing list