text formatting

Ian McKnight iangmcknight at gmail.com
Sat Jul 9 03:53:55 EDT 2011


Hi John

I would look at the HTMLtext property in the Manual/Dictionary.

You would take your text, line by line, and wrap each one with the
appropriate HTML code
eg
put "<font color=grey size=1>"&dateStamp&"</font>&cr into myMsg
put "<font color=black size=2><b>"&firstName&&surName&"</b></font>"&cr after
myMsg
put "<font color=blue>"&theMessage&"</font>"&cr after myMsg
set the HTMLText of fld "myField" to myMsg

To get the size 16 point text you may have too set the default text size of
the field to 16 - the HTML should vary it.
To get the ruled line I think it will be necessary to produce a graphic line
and use the <img src> tag to reference it.


I haven't tried this so you may have to change the colour references to
numeric values but this hopefully will put you on the correct track


On 9 July 2011 08:22, John Allijn <john.allijn at alice.nl> wrote:

> Hi,
>
> I have a textfield where I want to present a chunk of text, formatted in a
> few different styles.
>
> This is what the text looks like:
>
> ---
> On <timestamp>
> <firstname> <Lastname> wrote:
> <message text>
> ---
>
> and this is how I like to represent it:
>
> - the text "on timestamp" should be gray and 8 points
> - the firstname and lastname should be 10 points, black and bold
> - the message should be 16 points, blue, regular.
> - put in a divider-line
>
> The problem is that the message-text varies in length and that there may be
> multiple messages in the field. This means (but maybe I'm wrong) that I have
> to set the TextColor and TextSize properties while populating the field and
> that I cannot do this afterwards.
>
> So:
> - How can I set the style of the text, put some text in the field and
> change the style again?
> - how can I put in a horizontal line that separates the messages?
>
> thank you for your thoughts!
> John.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Regards


Ian McKnight

iangmcknight at gmail.com
=======================



More information about the use-livecode mailing list