Spaced Out

Richmond richmondmathewson at
Sun Sep 5 04:46:09 CDT 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


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"
            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