I'm not sure if this has not been asked already, if it has, please excuse me.
How does one pass a value from one card to another?
Thx
Passing values
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Passing values
Hi Nigel,
well, it depends
You could use GLOBAL variables or store values into a custom property of your stack or card or whatever.
...
## Store the content of the Vatiable tValue in a custom property of the current stack
## you can name the custom properties as you like, as long as they are not a "reserved word" in LiveCode
## I alway add a c at the beginning of the name:
set the cValueStorage of this stack to tValue
...
From now on you can access and modify that cp from everywhere in your stack(s):
...
put the cValueStorage of this stack into fld "value display"
put the cValueStorage of stack "other stack" into tValuet2
## etc...
...
Unlike variables (local or global) custom properties will get saved with the stack (in the IDE)!
Best
Klaus
well, it depends

You could use GLOBAL variables or store values into a custom property of your stack or card or whatever.
...
## Store the content of the Vatiable tValue in a custom property of the current stack
## you can name the custom properties as you like, as long as they are not a "reserved word" in LiveCode
## I alway add a c at the beginning of the name:
set the cValueStorage of this stack to tValue
...
From now on you can access and modify that cp from everywhere in your stack(s):
...
put the cValueStorage of this stack into fld "value display"
put the cValueStorage of stack "other stack" into tValuet2
## etc...
...
Unlike variables (local or global) custom properties will get saved with the stack (in the IDE)!
Best
Klaus
Re: Passing values
Klaus
Cool, thanks for the reply.
Cool, thanks for the reply.
Re: Passing values
Hi Nigel,
my pleasure!
Hint: Modifying CPs is a bit different since they cannot be edited directly!
You CANNOT:
...
delete line -1 of the cValueStorage of this stack
...
You need to do something like this:
...
## store in variable
put the cValueStorage of this stack into tTemp
## modify content of variable
delete line -1 of tTemp
## more stuff here...
## (over) write variable back to CP
set the cValueStorage of this stack to tTemp
...
Best
Klaus
my pleasure!
Hint: Modifying CPs is a bit different since they cannot be edited directly!
You CANNOT:
...
delete line -1 of the cValueStorage of this stack
...
You need to do something like this:
...
## store in variable
put the cValueStorage of this stack into tTemp
## modify content of variable
delete line -1 of tTemp
## more stuff here...
## (over) write variable back to CP
set the cValueStorage of this stack to tTemp
...
Best
Klaus
Re: Passing values
Klaus
Been reading up on Custom Properties and by using GetProp and SetProp, it fits my requirements perfectly for what I want to do. These two also remind me if the Set/Get properties of C# and seem to have the same functionality.
Once again thanks for your input.
Been reading up on Custom Properties and by using GetProp and SetProp, it fits my requirements perfectly for what I want to do. These two also remind me if the Set/Get properties of C# and seem to have the same functionality.
Once again thanks for your input.