There's a form of replace which preserves styling in fields these days (an FE we ran quite a while ago) - take a look at the replace entry in the dictionary.
Warmest Regards, Mark Sent from my iPhone > On 24 Jun 2017, at 07:14, J. Landman Gay via use-livecode > <use-livecode@lists.runrev.com> wrote: > >> On 6/23/17 6:48 PM, Bob Sneidar via use-livecode wrote: >> Okay so here is an odd thing. Given that the imageSource of char 1 of eack >> line of a scrolling field is set to a graphic (A plus sign in this case): >> on selectionChanged >> put the clickChar into tChar >> if tText is not space then exit selectionChanged >> put word 2 of the clickLine into tLine >> put the buttonlist of me into aButtonList -- an array >> put aButtonList ["buttonNames"] into tButtonList -- contains names of 3 >> buttons each line preceded by 2 tabs >> if tButtonList is not in me then >> put tButtonList before line tLine+1 of me -- works great! >> else >> replace tButtonList with empty in me -- removes the imageSource on >> char 1 of every line >> end if >> end selectionChanged >> This works, but on the second click it replaces the imageSource on every >> line. That shouldn't happen should it?? > > ImageSource is sort of like text styles, you can see it most clearly in the > htmlText of a field. An imageSource is represented by tags just like bold, > italic, and other styles. You'd see the same behavior if the lines were bold > instead of having an imageSource. > > Inserting some lines into a field doesn't change the styling of the other > lines, it just adds some additional unstyled text. > > The replace command works only on plain text and in this case the script is > passing the entire content of the field. The replace command gets the full > text, does the replacement, and puts the text back. As far as it's concerned, > the imageSource characters are just spaces. Styling tags are ignored and > consequently stripped out. > > You can either get the lineOffset of the unwanted lines and delete only > those, which leaves the htmlText intact elsewhere, or you could get the > htmlText of the field, do the replacement, and then set the field's htmlText > to the revised content. > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode