Inserting unicodeText into a unicode string? #3
bonnmike at gmail.com
Sun Aug 29 12:02:48 EDT 2010
Set up a simple stack with a button and a field. Put some text into the
field, and in the button put
put the selectedchunk
Make sure you have an active insertion point in the field and click the
It should put something like "char 22 to 21 of field 1" into the message
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:
Returns a chunk expression describing the location of the text selection or
put the selectedChunk into storedChunk
Use the selectedChunk function to determine which text is selected.
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>
> 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.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
More information about the Use-livecode