properties vs local variable

J. Landman Gay jacque at hyperactivesw.com
Mon Mar 10 15:52:00 EDT 2014


On 3/10/14, 2:29 PM, Terence Heaford wrote:
> Are you suggesting I can change the colour of the field using the
> htmlText and the merge command?

Yes.

> A sample line would be useful because I am not familiar with using
> the htmlText. I am familiar with merge.

Okay. Usually I set up styling, colors, etc. manually one time just so I 
can get the htmltext easily. Since you're iterating over a longish list, 
just set up the styling of a single line. Then I put the htmltext of the 
field into the message box, just so I have something to copy. Say it 
gives me this:

<p>This is text with an <font color="red">emphasized</font> word.</p>

I copy/paste that somewhere I can edit it and replace the literal text 
with merge markers:

<p>This is text with a <font color="[[tColor]]">emphasized</font> word.</p>

I save that as a custom property of the field, or whatever. Say it's 
called "cHTML".

In the handler:

put "blue" into tColor -- load the variable that merge will use
set the htmltext of fld 1 to merge(the cHTML of fld 1)

And it pops in all formatted.

In your handler you'd want to loop through all the lines in the data, 
changing the color variables as you go, and append a merge of the 
template line until you've got them all done. Then set the htmltext of 
the field to the variable.

I wrote the above without testing, so it may need tweaking. But that's 
the idea.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list