set the textStyle to not bold

Devin Asay devin_asay at byu.edu
Fri Oct 2 14:46:26 EDT 2009


On Oct 2, 2009, at 12:26 PM, Beat Cornaz wrote:

> Hi all,
>
> I have a field with text with different textStyles. Now I just want
> to remove the bold (or any other) textStyle from that field. So
> leaving all the underline, italic. box etc textStyle parts in order.
>
> set the textStyle of fld "X" to not bold   is accepted by the editor
> but throws an error at runtime. Probably because not bold equals
> false and you can't set a textStyle to false
>
> I could write a handler which checks the textStyle of every char and
> removes the bold, but I guess there is a more easy way.

Beat,

Try this (not tested):

repeat with i = 1 to the number of words in fld "thefield"
   get the textStyle of word i of fld "thefield"
   if it contains "bold" then
     replace "bold" with empty in it
     replace ",bold" with empty in it
     replace "bold," with empty in it
     set the textStyle of word i of fld "thefield" to it
   end if
end repeat

Something like this should work.

Regards,

Devin


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list