Setting more than 1 textStyle

Ken Ray kray at sonsothunder.com
Mon Dec 27 01:15:04 EST 2004


On 12/26/04 9:16 PM, "D.Rothe" <drothe at optusnet.com.au> wrote:

> Setting more than 1 textStyle
> With the following script it obviously sets the hilited word of a field to the
> chosen style. Select another style and it resets the word to plain text before
> applying the new style!
> How can I set the hilited word to more than one textStyle.... e.g Bold, Italic
> & Underlined or what ever combination?
> Is there a way to lock the text first or ???????????????

No, you get the textStyle of the selection, and then add another style to
make a combination. For example, if the textStyle if "plain", you replace it
with "bold", "italic", etc. If it is something other than "plain", you add
it with a comma between: "bold,italic", "italic,underline",
"bold,italic,underline", etc.

See the docs for the entry on "textStyle" for more information.
 
> p.s 1 other question, why does the text overflow onto the selection arrow of
> an option menu if the text is longer than the button is wide? Try it out, load
> your fonts into a option menu (width 100). Yeah sure you can make the button
> wider but some imported font names are ridiculously long e.g (Do Not Eat This
> Fat Italic).

Personally, I think this is a bug... but you can compare the formattedWidth
of the option button with the width of the optionButton to see if it is
larger. If so, you can start removing characters from the end until it fits.
Rev is fast enough to do this (even though it's laborious) so your user
won't see the changes (especially if it's under locktext), but personally
this should be handled automatically by Rev.

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the use-livecode mailing list