Skip to main content
Known Participant
March 17, 2010
Question

Can you return the word that your mouse is rolled over and its position?

  • March 17, 2010
  • 1 reply
  • 420 views

I seem to remember there is a way to do this. Might not even be part of TLF. In particular I will need to get the String and also its position within its parent container so I can access neighbouring words.

This topic has been closed for replies.

1 reply

Adobe Employee
March 19, 2010

There are some functions inside TLF that can be used to do this, but they are not part of the public interface. One place to look is at SelectionManager.computeSelectionIndex (it's a tlf_internal function). This takes an (x,y) coordinate and returns the position within the text. From that you can figure out what word it is in, by scanning forward or backward for spaces. If you want a version that is correct for all languages, see ParagraphElement.findNextWordBoundary and findPreviousWordBoundary.

- robin