Inserting unicodeText into a unicode string? #3

Mike Bonner bonnmike at gmail.com
Sun Aug 29 10:57:02 EDT 2010


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.

Again, i'm not a unicode guy so someone correct me if you have to do
things different.

On Sun, Aug 29, 2010 at 8:15 AM, Richmond <richmondmathewson at gmail.com> wrote:
>  "Oh, Dear, Richmond's on a roll . . . ."
>
> So; the story so far:
>
> Richmond has worked out how to shove unicodeText inside other unicodeText:
>
> on mouseUp
>    set the useUnicode to true
>    set the unicodeText of the selectedText to numToChar(50000)
> end mouseUp
>
>
> But, now, being one of those types who always wants more, he wants to
> check what the unicode Char precedes the insertion point . . .
>
> Tried:
>
> on mouseUp
>   set the useUnicode to true
>   if the unicodeText of the selectedText -1 = numToChar(32) then
>      set the unicodeText of the selectedText to numToChar(50000)
>   else
>      set the unicodeText of the selectedText to numToChar(60000)
>      end if
> end mouseUp
>
> which, bye-the-bye, the script-editor said was acceptable . . .
>
> [ quite WHY I thought of '-1' is hard to explain ]
>
> but no good at all . . .  :(
> _______________________________________________
> 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