Inserting unicodeText into a unicode string? #3

Mike Bonner bonnmike at gmail.com
Sun Aug 29 13:44:03 EDT 2010


Everyone likes cake. Or pie. Pie is good too. Someone needs to combine the
two, piecake would rock.

On Sun, Aug 29, 2010 at 11:27 AM, Richmond <richmondmathewson at gmail.com>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.
>
>  On Sun, Aug 29, 2010 at 10:15 AM, Richmond<richmondmathewson at gmail.com
>> >wrote:
>>
>>
>>
>>> On 08/29/2010 07:02 PM, Mike Bonner wrote:
>>>
>>>
>>>
>>>> Set up a simple stack with a button and a field.  Put some text into the
>>>> field, and in the button put
>>>>
>>>> on mouseup
>>>> put the selectedchunk
>>>> end mouseup
>>>>
>>>> Make sure you have an active insertion point in the field and click the
>>>> button.
>>>>
>>>> It should put something like "char 22 to 21 of field 1" into the message
>>>> box.
>>>>
>>>> If you had a selection it would be char firstpositionnumber to char
>>>> secondpositionnumber.  Since its just an insertion point it will always
>>>> be
>>>> of the relation -- word 2 is 1 more than word 4.
>>>>
>>>> As well, the dictionary contains this:
>>>>
>>>> *Summary:
>>>> Returns a chunk expression describing the location of the text selection
>>>> or
>>>> insertion point.
>>>>
>>>> Examples:
>>>> the selectedChunk
>>>> put the selectedChunk into storedChunk
>>>>
>>>>
>>>> Use the selectedChunk function to determine which text is selected.
>>>>
>>>> Value:
>>>> The selectedChunk function returns a chunk expression of the form
>>>>  char startChar to endChar of field fieldNumber
>>>> *
>>>>
>>>>
>>>> On Sun, Aug 29, 2010 at 9:53 AM, Richmond<richmondmathewson at gmail.com>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> On 08/29/2010 05:57 PM, Mike Bonner wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> In this case, the selectedtext is a property that contains no
>>>>>> positional information.  You can't do math on selectedtext unless it
>>>>>> just so happens to contain a number.
>>>>>> So, to do what you want you would need to use selectedchunk instead,
>>>>>> check it to see a) if its only an insertion point (word 4 of the
>>>>>> selectedchunk - word 2 of the selectedchunk will = -1 if this is the
>>>>>> case) then if I recall correctly, word 2 of the selectedchunk is the
>>>>>> cursor position so checking char (word 2 of the selectedchunk - 1)
>>>>>> will give you the char reference that you're looking for.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> I'd be very interested to know exactly where you recall 'word 4',
>>>>> 'word 2' and so on from as I cannot find anything like this in
>>>>> reference
>>>>> to selectedChunk.
>>>>> _______________________________________________
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>> Still fairly unclear to baboons like me . . .  :)  Mainly because the
>>> documentation doesn't explicitly mention words
>>> 4 - 1.
>>>
>>> I set up 4 flds and 'pumped' word 4 - 1 into the flds and got something
>>> like this:
>>>
>>> 14 to 15 char
>>>
>>> which shows fairly clearly that that is an insertion rather than a
>>> selection as the difference between
>>> words 4 and 2 is only 1: mind you, words 4 - 1 is a bit
>>> counter-intuitive.
>>>
>>> It is really only "a step away" from that to this:
>>>
>>> put word 4 of the selectedChunk into W4
>>> put char W4 of fld "fTX" into fld "fOUTPUT"
>>>
>>> giving one the char preceding the insertion point.
>>>
>>> Now, Ho - Ho - Ho; I shall have "a dark night of the soul" trying to do
>>> that lot for unicode . . . :)
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>>
>>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list