Page 1 of 1
How references work in clone stacks
Posted: Sat May 03, 2014 12:56 pm
by Mag
Hi all,
If I understand correctly, when you clone a stack and then in that stack, you use a command with references to a card, this command refers to the card of the cloned stack, right?
For example,
Code: Select all
the field 1 of card 2 of this stack
always refers to the field 1 one of the card 1 of the cloned stack, and not to the original stack, is this right?

Re: How references work in clone stacks
Posted: Sat May 03, 2014 1:09 pm
by Klaus
Hi Mag,
Hint:
don't use THE when addressing object in Livecode!

Bad:
THE field 1 of card 2 of this stack
Good:
field 1 of card 2 of this stack
Well, it depends what the currently active "default" stack is, and WHEN and WHERE you fire this command.
Do you do this right after cloning the stack?
If in doubt, use the name of the cloned or target stack to be sure to address the correct stack!
Best
Klaus
Re: How references work in clone stacks
Posted: Sat May 03, 2014 1:24 pm
by Mag
Hi Klaus, thank you for the replay. The handler which refers to the object is already present in the cloned stack, so could be difficult to refer to the real stack name which is unknow at the time I wrote the handler.

Re: How references work in clone stacks
Posted: Sat May 03, 2014 1:34 pm
by Mag
I made a stack for testing, If someone is so kind to try it and sees possible problems, please posts here his doubts and advices.
Re: How references work in clone stacks
Posted: Sun May 04, 2014 12:37 am
by Simon
Hi Mag,
I'm not clear on what you are asking in reference to the stack you posted?
It seems to be doing what it's supposed to? Logs are correctly posted to their fields.
Simon
Re: How references work in clone stacks
Posted: Sat May 10, 2014 11:42 am
by Mag
Hi Simon,
I made this stack to test if when a handler of an object tells "this stack" the target is the stack that own the object, regardless if the stack is the front most or not. Because I'm not sure if the test is constructed in the right way, I would be happy to hear other opinions and recommendations. Thank you for your feedback!