Inserting unicodeText into a unicode string? #3

Mark Schonewille m.schonewille at economy-x-talk.com
Sun Aug 29 15:35:40 EDT 2010


Richmond,

Unfortunately, it is slightly more complicated. Before you set the unicodeText of the selectedText, you need to make sure that the number of chars before the text insertion point is even. If it isn't, you need to move the text insertion point by one position. Once you've done that, you should be able to set the unicodeText relatively crash-less ;-) Be careful, as the selectedChunk can be confusing. If the selection itself is empty, you would see something like this: 

char 10 to 9 of field 2

The second number is the number of characters before the text insertion point. Here's an example that moves the text insertion point forward:

on mouseUp
     if the selectedChunk is not empty then
          put the selectedChunk into myChunk
          add 1 to word 2 of myChunk
          add 1 to word 4 of myChunk
          select myChunk
     end if
end mouseUp

The script is not complete. It doesn't check whether it has run out of chunks.

--
Best regards,

Mark Schonewille

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

From 15th August, we'll have time for new projects! Be the first in line and contact me now!

Download the Installer Maker plugin for Runtime Revolution at http://qurl.tk/ce

On 29 aug 2010, at 19:27, Richmond wrote:

> On 08/29/2010 07:19 PM, Mike Bonner wrote:
>> Yep, same difference, using word 4 works.  The main thing is to make sure
>> you catch actual selections and change behavior accordingly.  Should be a
>> piece of cake now that you grok selectedchunk.
>>   
> 
> That presupposes one likes cake.
> 



More information about the Use-livecode mailing list