Make Hyperlinks active

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 10:53 am

I have a field populated by query that is a link to website. I have followed the "tutorials". The field shows it is a link - underlined in blue. Whether locked or unlocked it can't be clicked on. What else needs to be done? Searches both inside and outside Livecode for workable answers gave nothing.
Last edited by bbhank on Sun Apr 10, 2016 6:10 pm, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Make Hyperlinks active

Post by Dixie » Sun Apr 10, 2016 11:13 am

look at linkclicked in the dictionary.. for example, the handler below was placed in the stack script...
In the text of a fld , i put "http://www.bbc.co.uk" and made the address a link... lock the text of the field...

Code: Select all

on linkClicked pLink -- open the URL stored with the clicked text
    launch url pLink
end linkClicked

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6238
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Make Hyperlinks active

Post by dunbarx » Sun Apr 10, 2016 3:36 pm

Hi.

I never looked at a lesson, but did it really leave you hanging without a way forward?

What Dixie said, and also you might know that (assuming the field is locked):

Code: Select all

on mouseUp
launch URL the clickText
end mouseUp
is another way.

Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6963
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Make Hyperlinks active

Post by FourthWorld » Sun Apr 10, 2016 4:05 pm

The benefit of the linkclicked message is that it only triggers when clicking on text with a link style, whereas mouseup will trigger for all mouse activity within the field, outside of link text and even outside of any text at all if the field is larger than its contents.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6238
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Make Hyperlinks active

Post by dunbarx » Sun Apr 10, 2016 4:59 pm

Richard.

Good point. And I suppose that validating the style of the clickText would require an extra step.

I guess I was more interested in suggesting a basic technique than thinking through the issues.

Craig

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Re: Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 6:46 pm

Tried each of the suggestions, including dictionary. None work so far. What's missing here? Tried each in both the stack script and field script.
:(

Klaus
Posts: 11275
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Make Hyperlinks active

Post by Klaus » Sun Apr 10, 2016 6:58 pm

bbhank wrote:Tried each of the suggestions, including dictionary. None work so far. What's missing here? Tried each in both the stack script and field script.
:(
Please post your script(s) and where exactly you put them!

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Re: Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 9:57 pm

I used the scripts above and tried each of them in the stack as well as the link itself.
Exactly where do they go?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Make Hyperlinks active

Post by Dixie » Sun Apr 10, 2016 10:02 pm

bbhank...

try this stack
Attachments
Untitled 1.zip
(1.6 KiB) Downloaded 38 times

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Re: Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 10:09 pm

The link in the zip file works. See original question. My links are from a database. Might that that part of the problem?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Make Hyperlinks active

Post by Dixie » Sun Apr 10, 2016 10:16 pm

As Klaus said... 'Post your scripts"

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Re: Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 10:22 pm

Code: Select all

set the text of field "Link" of me to pDataArray["label 7"]
and

Code: Select all

set the textStyle of field "Link" to link
.

The second code was sent using the message box as per instruction in tutorial at http://lessons.livecode.com/m/4071/l/74 ... -in-fields. This made it look like an active link but wasn't clickable.

The field gets its information from the Row Behavior, which is the first line of code above.
Does this help any?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6238
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Make Hyperlinks active

Post by dunbarx » Sun Apr 10, 2016 11:40 pm

Ah.

I am always the last to know that the OP is either working with mobil, or with a dataGrid.

Craig

bbhank
Posts: 116
Joined: Thu Mar 17, 2016 6:04 pm

Re: Make Hyperlinks active

Post by bbhank » Sun Apr 10, 2016 11:50 pm

Datagrid. My oops. :oops:

Klaus
Posts: 11275
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Make Hyperlinks active

Post by Klaus » Mon Apr 11, 2016 10:09 am

Sigh, baby steps... 8)

OK, now show us the bahaviour script of your datagrid,
that is where the "mouseup" stuff should go.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”