Caret/insert position in field

Jeff Massung massung at gmail.com
Fri May 14 15:14:21 EDT 2010


Just want to take a moment and re-explain my problem a little.

The user is typing in the field, and I'd like to do some special formatting
when the user hits the tab key. So, immediately I have:

on tabKey
  put the selectedLine
end tabKey

This will give me something like "line 204 of field 2", which is great, and
I can use that to get the text on that line so I can begin formatting.

The problem is that I need to know the user's caret (insert) position,
because the formatting will behave differently if the insert position is at
the beginning of the line as opposed to somewhere in the middle. For
example, if at the beginning, it might actually insert a tab, otherwise it
will do something else.

But, I can't seem to figure out where the insert position within that line
happens to be. The selectedChunk returns characters from the start of the
field.

Thanks for the suggestions.

Jeff M.



More information about the use-livecode mailing list