set the textStyle to not bold

Paul Foraker paul.foraker at gmail.com
Fri Oct 2 16:55:37 EDT 2009


Riffing on Devin's:

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 "plain" in it
   set the textStyle of word i of fld "thefield" to it
 end if
end repeat

-- Paul


On Fri, Oct 2, 2009 at 11:46 AM, Devin Asay <devin_asay at byu.edu> wrote:

>
> 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
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list