select after the selectedText

Peter Brigham MD pmbrig at gmail.com
Wed Jul 6 07:47:21 EDT 2011


On Jul 6, 2011, at 3:47 AM, Richmond Mathewson wrote:

> On 07/06/2011 10:38 AM, Mark Wieder wrote:
>> Richmond-
>> 
>> Wednesday, July 6, 2011, 12:19:41 AM, you wrote:
>> 
>>> I have just tried this:
>>> on mouseUp
>>>     set the useUnicode to true
>>>     set the unicodeText of the selectedText to numToChar(2340)
>>>    select after char -1 of field X
>>> end mouseUp
>> Untested, but what about
>> 
>> on mouseUp
>>   local tChunkChar, tChunkField
>> 
>>   set the useUnicode to true
>>   put word 4 of the selectedChunk into tChunkChar
>>   put word -1 of the selectedChunk into tChunkField
>>   set the unicodeText of the selectedText to numToChar(2340)
>>   select after char tChunkChar of field tChunkField
>> end mouseUp
>> 
> 
> A good thought; however, there is NO selectedChunk insofar as
> the end-user starts his/her edit with a selectedText that is NOT a chunk, just
> a cursor insertion point.
> 
> Just tried it and it threw this:
> 
> execution at line 5116 (Chunk: no such object), char 12

Try this, perhaps?

on mouseup
   put 1 + (word 4 of the selectedchunk) into saveMark
   -- this will be the first character after the selection
   put length(char saveMark to -1 of fld "myUnicodeFld") into savedLength
   put (-1)*savedlength into savedLength
   set the useUnicode to true
   set the unicodeText of the selectedText to numToChar(2340)
   select before char savedLength of fld "myUnicodeFld"
end mouseup

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig






More information about the use-livecode mailing list