Hyperlinks in multiline displayNewText

As a part of our Android app. in Corona, we’re supposed to display a collection of texts in a scroll view, and make certain words in sentences hyperlinks to another preassigned objects. However, those texts are display objects, so they do not support in-text, standard hyperlinks.

Our idea for the solution was to create a invisible field with listener on top of the keyword, however it’s specific position is unknown due to various formatting details.

Calculating the position based on the order of sentence containing the word, font specifications, screen resolutions, wrapping, etc. would be troublesome and resource-consuming, especially noticeable as there would be hundreds of them generated dynamically in front of a user.

Question: does anyone have an idea for possible, more graceful solution? Inserting hyperlinks, or acquiring the position?

Generally, this part of the app. should look as in this template:http://imageshack.com/a/img673/4768/NjB1nt.png

white field is a scroll view, containing 6 displayNewText obects. The keyword is “art.166” displayed with a blue color font, it should work as a hyperlink.

blue field is the popup object called by hyperlink.

If I were you, I would entirely abandon the idea of using Corona text objects to simulate HTML, and use actual HTML in a web view instead. Aside from the hassle of creating HTML behavior like clickable links, if you really have hundreds of texts, you are also likely to encounter performance issues, because text objects in Corona are really just masked images.

However, if you want to pursue the path of faking HTML with text objects, there’s a library here which could be a starting point for you: http://code.coronalabs.com/code/html-styled-text

Here is one option: https://github.com/mimetic/corona-styled-textwrap

or another, my first (and only) attempt at this (kind of old but still functional):  https://github.com/roaminggamer/RG_FreeStuff/tree/master/MLText

https://www.youtube.com/watch?v=B4R2-7gJciY

If I were you, I would entirely abandon the idea of using Corona text objects to simulate HTML, and use actual HTML in a web view instead. Aside from the hassle of creating HTML behavior like clickable links, if you really have hundreds of texts, you are also likely to encounter performance issues, because text objects in Corona are really just masked images.

However, if you want to pursue the path of faking HTML with text objects, there’s a library here which could be a starting point for you: http://code.coronalabs.com/code/html-styled-text

Here is one option: https://github.com/mimetic/corona-styled-textwrap

or another, my first (and only) attempt at this (kind of old but still functional):  https://github.com/roaminggamer/RG_FreeStuff/tree/master/MLText

https://www.youtube.com/watch?v=B4R2-7gJciY