Spaced Out

Richmond richmondmathewson at gmail.com
Sun Sep 5 05:46:09 EDT 2010


I am poking around in a textField to ascertain if the
double-byte char just before the insertion point is either:

1. Bang up against the left-hand side of the textField

or

2. A space.

#1 is dead easy; the space is proving rather difficult.

My code goes something like this:

on mouseUp
    set the useUnicode to true
       put the word 4 of the selectedChunk into W4
       put (W4 - 1) into W5
       get charToNum(char W5 to W4 of fld "MyGuff")
         if it = empty or space then
            put "EMPTY or SPACE"
         else
            put "STUFF HERE"
         end if
end mouseUp

tried replacing "space" with "32"

for some funny reason this detects the left-hand side of the fld "MyGuff",
but not if there is a space on the left of the insertion point.

A real bu**er right now.

sincerely, Richmond.



More information about the use-livecode mailing list