Clickable URL link from a field

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Duncan
Posts: 13
Joined: Wed Feb 25, 2009 4:25 pm
Contact:

Clickable URL link from a field

Post by Duncan » Tue Mar 24, 2009 10:06 pm

Have been experimenting with creating a clickable link from text in a field. Using

Code: Select all

if mouseText () ="clickable" then launch url "http://w....
which works. I also tried using clickText but I did not manage to make that work.

If this is the way to do this I am left with a couple of questions:

The text that you click on does not indicate that it is a clickable link. Is there some way to make it appear so or should it just be Styled -underlined etc?

It seems only a single word can be clicked on. Ideally I would like to click anywhere on "some clickable text" as a link. I did see mention of GroupText (or possible TextGroup) in the docs but did not manage to find any details.

Am I heading in the right direction? Any pointers where to head next will be much appreciated.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Mar 25, 2009 12:47 am

Hi Duncan,

This is not the way to do it. Instead, set the textStyle of the text you want to be clickable to "link". Create a script that checks which text has been clicked on. To give you some idea of how that works:

Code: Select all

on linkClicked theLink
  if theLink contains "(see card 2)" then
    go cd 2
  else if char 1 to 7 of theLink is "http://" then
    launch url theLink
  else if theLink contains "@" then
    revMail theLink
  else
    beep
  end if
end linkClicked
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Duncan
Posts: 13
Joined: Wed Feb 25, 2009 4:25 pm
Contact:

Post by Duncan » Fri Mar 27, 2009 7:19 pm

Thanks. I thought I was straying away from some obvious solution.

Post Reply