Hyperlink (event detectable) Text?

If you’ve ever tried Instagram you’ve noticed that hastags are shaded blue and you can click on a hashtag and Instagram will re-display a listing of pictures with that hashtag.

Ignoring all the internals that go on with the searching (easy part) has anyone ever tried with the native or display text options of Corona to:

1: Detect and colorize specific text such as a hashtag?

2: Enabled an event handler response (touch) for specific text such as a hashtag?

Thanks in advance! [import]uid: 156018 topic_id: 36100 reply_id: 336100[/import]

Slightly misleading comment there…you could certainly come up with something in Corona to achieve this effect without purchasing an enterprise license.

That said I don’t have the time right now to come up with a solution myself but I’m sure it can be done! [import]uid: 93133 topic_id: 36100 reply_id: 143462[/import]

One way this could be done is with a text field that recognized HTML tags and provided an event handler for any hyperlink that was touched, with the text of the hyperlink as one of the event parameters.

Searched but alas, no such feature in Corona. :frowning: [import]uid: 156018 topic_id: 36100 reply_id: 143473[/import]

Hi @lessmsios,

It’s true that Corona doesn’t currently feature built-in “inline” text formatting like bolding, underlining, or hyper-linking individual words within a text block. However, if your goal is to output the text to the screen, you should check out the following CodeShare project by helpful Corona developer “richard9”. This might give you the required control to output your words and apply different “formatting” to them, including the inclusion of a clickable event listener.

http://developer.coronalabs.com/code/typer-way-type-text-out-letter-letter

Sincerely,
Brent Sorrentino [import]uid: 200026 topic_id: 36100 reply_id: 143483[/import]

Hi guys - and just a quick comment here to address John Salinger’s post.

Corona Enterprise is NOT $3000. For indies/small companies, it is $999/developer/year. For larger companies it is $2499/developer/year.

Thanks.

David [import]uid: 10668 topic_id: 36100 reply_id: 143507[/import]

Thank you all.

After further investigating what I’d like to do might be possible with the WebView - generating the html dynamically and handling events should a user click on a hashtagged word. Worth giving it a try. [import]uid: 156018 topic_id: 36100 reply_id: 143513[/import]

Wow John, that’s a pretty vitriolic comment - and fairly off mark. To balance your opinion I would say, yes, this is possible with the basic version of Corona, and it would probably cost me about 2 hours of coding:

  • split up the source text into different chunks by analyzing for specific characters (like a # for a hashtag, for instance).
  • display the different chunks of text together, format the link parts differently (let’s say, bold and blue, and maybe even add a line underneath this text) with some logic to check the width of text chunks so formatting makes sense.
  • add an eventListener to only the text you want to be clickable.

Et voila!

Furthermore, I’d like to add that it’s sad to see some people become disgruntled about the enterprise edition’s price. If you don’t like it don’t buy it, but stop complaining, and be thankful for the fact that software has NEVER been more affordable and accessible than it is now. Sheesh. I worked my ass off 15 years ago to save up the exorbitant prices asked for a computer and software that a highschool kid can now basically buy with his earnings from a summer job - and this is for material that can earn you a living - but still people complain. Oh well… [import]uid: 70134 topic_id: 36100 reply_id: 143517[/import]

I did a photo gallery app for photos from Yosemite park and in there I made links for each photographer to lead people back to the photographer’s website.

Now my blue text wasn’t inline, it was a separate line, but I added a touch handler that does a system.openURL. Trying to add those inline would be more tricky to do, but with some work it can be done. The easiest way is to probably new a native.newWebView to handle it for you.
[import]uid: 199310 topic_id: 36100 reply_id: 143522[/import]

Slightly misleading comment there…you could certainly come up with something in Corona to achieve this effect without purchasing an enterprise license.

That said I don’t have the time right now to come up with a solution myself but I’m sure it can be done! [import]uid: 93133 topic_id: 36100 reply_id: 143462[/import]

One way this could be done is with a text field that recognized HTML tags and provided an event handler for any hyperlink that was touched, with the text of the hyperlink as one of the event parameters.

Searched but alas, no such feature in Corona. :frowning: [import]uid: 156018 topic_id: 36100 reply_id: 143473[/import]

Hi @lessmsios,

It’s true that Corona doesn’t currently feature built-in “inline” text formatting like bolding, underlining, or hyper-linking individual words within a text block. However, if your goal is to output the text to the screen, you should check out the following CodeShare project by helpful Corona developer “richard9”. This might give you the required control to output your words and apply different “formatting” to them, including the inclusion of a clickable event listener.

http://developer.coronalabs.com/code/typer-way-type-text-out-letter-letter

Sincerely,
Brent Sorrentino [import]uid: 200026 topic_id: 36100 reply_id: 143483[/import]

Hi guys - and just a quick comment here to address John Salinger’s post.

Corona Enterprise is NOT $3000. For indies/small companies, it is $999/developer/year. For larger companies it is $2499/developer/year.

Thanks.

David [import]uid: 10668 topic_id: 36100 reply_id: 143507[/import]

Thank you all.

After further investigating what I’d like to do might be possible with the WebView - generating the html dynamically and handling events should a user click on a hashtagged word. Worth giving it a try. [import]uid: 156018 topic_id: 36100 reply_id: 143513[/import]

Wow John, that’s a pretty vitriolic comment - and fairly off mark. To balance your opinion I would say, yes, this is possible with the basic version of Corona, and it would probably cost me about 2 hours of coding:

  • split up the source text into different chunks by analyzing for specific characters (like a # for a hashtag, for instance).
  • display the different chunks of text together, format the link parts differently (let’s say, bold and blue, and maybe even add a line underneath this text) with some logic to check the width of text chunks so formatting makes sense.
  • add an eventListener to only the text you want to be clickable.

Et voila!

Furthermore, I’d like to add that it’s sad to see some people become disgruntled about the enterprise edition’s price. If you don’t like it don’t buy it, but stop complaining, and be thankful for the fact that software has NEVER been more affordable and accessible than it is now. Sheesh. I worked my ass off 15 years ago to save up the exorbitant prices asked for a computer and software that a highschool kid can now basically buy with his earnings from a summer job - and this is for material that can earn you a living - but still people complain. Oh well… [import]uid: 70134 topic_id: 36100 reply_id: 143517[/import]

I did a photo gallery app for photos from Yosemite park and in there I made links for each photographer to lead people back to the photographer’s website.

Now my blue text wasn’t inline, it was a separate line, but I added a touch handler that does a system.openURL. Trying to add those inline would be more tricky to do, but with some work it can be done. The easiest way is to probably new a native.newWebView to handle it for you.
[import]uid: 199310 topic_id: 36100 reply_id: 143522[/import]

Slightly misleading comment there…you could certainly come up with something in Corona to achieve this effect without purchasing an enterprise license.

That said I don’t have the time right now to come up with a solution myself but I’m sure it can be done! [import]uid: 93133 topic_id: 36100 reply_id: 143462[/import]

One way this could be done is with a text field that recognized HTML tags and provided an event handler for any hyperlink that was touched, with the text of the hyperlink as one of the event parameters.

Searched but alas, no such feature in Corona. :frowning: [import]uid: 156018 topic_id: 36100 reply_id: 143473[/import]

Hi @lessmsios,

It’s true that Corona doesn’t currently feature built-in “inline” text formatting like bolding, underlining, or hyper-linking individual words within a text block. However, if your goal is to output the text to the screen, you should check out the following CodeShare project by helpful Corona developer “richard9”. This might give you the required control to output your words and apply different “formatting” to them, including the inclusion of a clickable event listener.

http://developer.coronalabs.com/code/typer-way-type-text-out-letter-letter

Sincerely,
Brent Sorrentino [import]uid: 200026 topic_id: 36100 reply_id: 143483[/import]

Hi guys - and just a quick comment here to address John Salinger’s post.

Corona Enterprise is NOT $3000. For indies/small companies, it is $999/developer/year. For larger companies it is $2499/developer/year.

Thanks.

David [import]uid: 10668 topic_id: 36100 reply_id: 143507[/import]

Thank you all.

After further investigating what I’d like to do might be possible with the WebView - generating the html dynamically and handling events should a user click on a hashtagged word. Worth giving it a try. [import]uid: 156018 topic_id: 36100 reply_id: 143513[/import]