Jeff Massung wrote:
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.

This seems to work but I'm not sure how fast it would be on huge data sets. The engine is pretty fast in general though when it comes to text chunking:

function charCount
  put (the number of chars in line 1 to (word 2 of the selectedline)-1 \
         of me) + 1 into tTotal -- to end of prev line plus the CR
  put word 4 of the selectedchunk into tCharPos
  return tCharPos - tTotal
end charCount

That extra "+1" at the end of the first line is to account for the carriage return, which Rev won't count otherwise.

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to