Links that call a function

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
garyth123
Posts: 88
Joined: Sat Apr 27, 2013 11:14 am
Contact:

Links that call a function

Post by garyth123 » Thu Oct 17, 2013 4:32 pm

Hi,

I need to have some pieces of text which are contained in a line in a field and that are links, but when clicked on do not take the user away from the current screen, but instead call a function which will update the screen with the results of the function call.

Eg a line in the field could look like the below

some text "call x1" "call x2" "call x3" "call x4"

Clicking on "call x1" invokes the function with 1 passed as parameter. Clicking on "call x2" calls the same function with 2 passed as a parameter. And so on.

On the same screen the result of the function would be displayed.

I have found textStyle, and linkText, but these are for navigating away from the current card/screen?

Does anyone have any ideas how I could achieve what I am looking to do as described above?

Thanks as ever.

Gary

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Links that call a function

Post by dunbarx » Thu Oct 17, 2013 4:41 pm

Hi.

Though the field must be locked, the "linkClicked" message should do what you want. The clicked text has be grouped.You can distinguish which text is clicked on in several ways, the "linkText" is one, or you can get the "clickText" and roll your own,

Code: Select all

on linkClicked
  --addYourFunctionOrCommandHere
end linkClicked
Craig Newman
Last edited by dunbarx on Thu Oct 17, 2013 4:44 pm, edited 1 time in total.

garyth123
Posts: 88
Joined: Sat Apr 27, 2013 11:14 am
Contact:

Re: Links that call a function

Post by garyth123 » Thu Oct 17, 2013 4:44 pm

That looks good, and the field will be a locked one. Thanks for the quick reply Craig.

Post Reply