Replacing Text

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Jan 25 12:34:50 EST 2010


Hi Warren,

The selectedChunk is a reference to particular characters in a field.  
Also, the selectedChunk of fld x isn't a reference the actual text in  
that field but rather a string containing that reference.

For example, if you tell Revolution to replace "xyz" with "abc" in  
"char 1 to 2 of field 1" it isn't going to work.

You might try this.

put the selectedText into mySelection
replace mySelection with "<b>" & mySelection & "</b>" in field x

or

put the selectedText into mySelection
put "<b>" & mySelection & "</b>" into the selectedChunk

I have tested this and both methods work.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer

Try the new URL shortening service http://qurl.tk

Op 25 jan 2010, om 18:20 heeft Warren Kuhl het volgende geschreven:

> I am trying to replace a selected chunk of text with the selectedchunk
> of text and some html codes.  I tried the code below and the software
> doesn't like this.
>
> replace the selectedtext of field "field" with "<b>" & the
> selectedtext of field "field" & "</b>" in the selectedchunk of field
> "field"
>
> I could use:
> replace the selectedtext of field "field" with "<b>" & the
> selectedtext of field "field" & "</b>" in field "field"
> ...but the replace would replace all occurrences of the text in my
> field...instead of just the selectedchunk.
>
> How would I accomplish this?  I assume it is something simple.
>
> Warren





More information about the use-livecode mailing list