Find/Replace removes text style

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Find/Replace removes text style

Post by sefrojones » Thu Jun 19, 2014 12:48 am

I'm finding that when I do a find and replace, that all of the text styles (e.g. bold, italic, etc) are removed from the field when the target word is replaced. I'm using LC 6.6.2 on Windows 764 bit. Is this a bug, or is there a way to turn this behavior off?
Thanks,

Sefro

PBH
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 133
Joined: Sun Feb 20, 2011 4:26 pm
Contact:

Re: Find/Replace removes text style

Post by PBH » Thu Jun 19, 2014 2:39 am

Sefro,

There is a note about this behaviour in the dictionary, so it's not seen as a bug.

Here's the note…
Important! You can use the replace command on a field, but doing so removes any formatting (fonts, styles, colors, and sizes) in the field. To work around this limitation, use the field's htmlText property as the source for replacement instead of using the field itself as the source:

get the htmlText of field "Stuff"
replace "old" with "new" in it
set the htmlText of field "Stuff" to it
HTH

Paul

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Find/Replace removes text style

Post by sefrojones » Thu Jun 19, 2014 5:08 am

I can't believe I didn't look in the dictionary, since I was using the built in Find and replace I had hoped this wasn't the case. Thanks for the info.

Post Reply