position of text-curson within field

Nicolas Cueto niconiko at gmail.com
Mon Feb 19 20:01:51 EST 2018


I'm trying to script a special backspace script.

As is the usual backspace behavior, I still want the char to the left of
the flashing cursor to be deleted. Wherever that cursor happens to be.

But because the backscape key cannot get passed, it seemsI have to manually
delete that character to the left of the flashing cursor (wherever the
cursor happens to be).

So, how do I find out in terms of relative character position (eg. char 275
of field x) where within a text field is the flashing cursor?

Something like:

on backspaceKey
 put the <<position of the flashing cursor>> in field x into tPos
 -- e.g. tPos = char 275 of field x
 delete char tPos of field x
 put the number of lines in field x into field "Nr of lines"
end backspaceKey

As you can see, the reason I'm interrupting the backspace key is to find
out the number of lines in a field after a char is deleted.

--
Nicolas Cueto



More information about the use-livecode mailing list