calling functions in the scripts of other objects

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: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
vanderpump
Posts: 6
Joined: Sun Sep 28, 2008 4:20 pm
Contact:

calling functions in the scripts of other objects

Post by vanderpump » Sun Sep 28, 2008 5:46 pm

Hi,
yesterday I downloaded Revolutions Media 3.0 and have been having fun ever since.
However, I cannot find documentation on how to call functions in objects other than the one's they're defined in.
Kindly help.

I have a function and a method in the script of a text field : myTextField

Code: Select all

on beepMethod theparam
   beep
end beepMethod

function beepFunction theparam
   beep
   return true
end beepFunction
I have a button callMethodButton with script

Code: Select all

on mouseUp
    send beepMethod && "0" to card field "myTextField"
end mouseUp
This script works.
However, the script of the next button no matter what I tried, including using the documented get value(beepFunction(0), of card field "myTextField") I cannot get to work.

The following looks to me (and the compiler) like the sort of thing that should be ok ... but isn't !
What does the correct syntax look like?

Script of callFunctionButton

Code: Select all

on mouseUp
   get beepFunction(0) of card field "myTextField"
end mouseUp
Thanks
Julius

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Sun Sep 28, 2008 5:55 pm

Hi Julius,

this is a case that is not as obvious, as one would like. Value is your friend here:

get value("beepFunction(0)",fld "myTextField")

Hope that helps,


Malte

vanderpump
Posts: 6
Joined: Sun Sep 28, 2008 4:20 pm
Contact:

Post by vanderpump » Sun Sep 28, 2008 6:11 pm

Hi Malte
thanks for the quick reply.
Perfectly magic.

BTW would you happen to know why the syntax takes this string-evaluation-like form?

all the best
Julius

Post Reply