Setting a character with imagesource through htmlText?

Scott Rossi scott at tactilemedia.com
Wed Mar 2 10:05:10 EST 2005


Recently, Geoff Canyon  wrote:

> If you set the text of a field to "test" and then set the imagesource
> of char 3 of that field to 20, you'll see "te" followed by a beachball
> followed by "t"
> 
> If you put that field, you'll get "test"
> 
> If you put the htmlText of the field, you'll get:
> 
> <p>te<img src="20">t</p>
> 
> Note the absence of the character "s"
> 
> If you set the htmlText of the field to the htmlText of the field,
> there will be no visible change. But if you put the field, you'll now
> get "te t" with a space where the "s" used to be.
> 
> Question 1: is this a bug? I think so. I don't see this in bugzilla, so
> if consensus is that this is a bug I'll enter it.
> 
> Question 2: any ideas for a workaround? Setting the htmlText of a field
> is dramatically faster than putting text into it and then setting the
> imageSource of each character individually, but it can be very handy to
> have a character hidden within an image, since it can be a quick
> reference to what the image is.

When I set the HTMLtext by script:

 set the HTMLtext of fld 1 to \
      "<p>tes<img src=" & quote & "1005" & quote & ">t</p>"

I get the expected result in the field:  tes[image]t

When I put the field, I get:  <p>tes<img src="1005">t</p>

So using the imageSource property appears to effectively "cloak" the
selected character, while setting the HTMLtext by script gives the expected
results.

Jerry Daniels has found that setting imageSource via script (in reality,
setting the HTMLtext of the field) is much faster than setting the
imageSource character by character.  So perhaps this could be your
workaround, and a faster workaround at that.  It's just a little more coding
to accommodate the HTML tags.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list