In what context does a backscript run?

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
dpatterson
Posts: 24
Joined: Wed Jan 18, 2017 5:38 pm

In what context does a backscript run?

Post by dpatterson » Thu Jan 19, 2017 8:51 pm

I am attempting to place a card script into back.
It appears that it when it is called, it is no longer in the context of the card that owns it.

So, the question is: What is the context?

TIA,
Dave

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: In what context does a backscript run?

Post by MaxV » Tue Jan 24, 2017 5:52 pm

It depends of what do you intend for context.
For example I have a button named button2 with this code:

Code: Select all

on mouseUp
   answer the long name of me
end mouseUp
then I type in the message box:

Code: Select all

insert script of button "button2" into back
Now when I click on my stack I get: button "button2" of card id 1002 of stack "/home/max/temp/example.livecode"

So it's owner and context to me is the same, you can use properties as usual.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

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

Re: In what context does a backscript run?

Post by dunbarx » Tue Jan 24, 2017 6:16 pm

What Max said.

Just like behaviors, the target retains its "local" character, regardless of the place in the hierarchy where a message is ultimately trapped.

Craig

Post Reply