Changing text in formatted field

Mark Schonewille m.schonewille at economy-x-talk.com
Wed Aug 20 21:04:22 EDT 2008


Hi Shari,

Probably, Sarah wanted (or could have wanted) to write this:

put the textStyle of word 3 of fld "Formatted" into tStyle
put "new" into word 3 of fld "Formatted"
set the textStyle of word 3 of fld "Formatted" to tStyle

If you want to append text to a field, you can do this:

put number of chars of fld x into myNrOfChars
put the textStyle of last char of fld x into theStyle
put myWhateverText after fld x
set the textStyle of char myNrOfChars to -1 of fld x to theStyle

Of course, you can also put text before a field, or before char y of  
fld x or after char y of fld x etc and you can set the textStyle of  
the added text to char 1 of fld x, char y-1 of fld x or char y of fld  
x respectively.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
http://facebook.economy-x-talk.com

Benefit from our inexpensive hosting services. See http://economy-x-talk.com/server.html 
  for more info.

On 21 aug 2008, at 01:25, Sarah Reichelt wrote:

> On Thu, Aug 21, 2008 at 9:14 AM, Shari <shari at gypsyware.com> wrote:
>> If I've got a field with nicely formatted text, some bold, some  
>> underlined,
>> etc., is there a way from within a script to change a word in that  
>> field
>> without losing the formatting?
>
> Untested, but how about storing the textStyle, changing the word, then
> re-setting the styles.
>
> e.g.
>
> put the textStyle of word 3 of fld "Formatted" into tStyle
> put "new" into fld "Formatted"
> set the textStyle of word 3 of fld "Formatted" to tStyle
>
> Cheers,
> Sarah





More information about the use-livecode mailing list