Page 1 of 1
Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 10:53 am
by shalu
Hi,
I am Beginner in LiveCode, I have a variable which holds some data, I want to pass this variable through Custom Properties is it possible
--
Thanks,
Shalu S
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 11:32 am
by jmburnod
Hi Shalu,
I want to pass this variable through Custom Properties is it possible
YES
Code: Select all
set the uMyCustom of control "mycontrol" to MyVariable
Best regards
Jean-Marc
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 12:01 pm
by shalu
Hi
I have to place the code inside Property contents is it ok? please advise
Thanks
Shalu
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 12:30 pm
by Klaus
Hi shalu,
shalu wrote:I have to place the code inside Property contents is it ok?
no!
You "fill" and "use" a custom property just like a variable inside of your scripts,
but with a slightly different syntax.
See the differences in this little example:
Fill a variable:
put "some data" into myVariable
Fill (SET) a custom property, which is always "tied" to any Liveocde object -> stack, card or any control:
set the cPropertyName of this stack to "some data"
Retrieving a variable:
put myVariable into fld "your field"
Retrieving a custom property:
put the cPropertyName of this stack into fld "your field"
Does this make it a bit clearer?
Best
Klaus
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 4:20 pm
by dunbarx
Shalu.
Custom properties can hold a far larger variety of data than a variable, and they also survive sessions. They are similar to a "global" variable, but do not have to be declared.
Craig Newman
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 5:18 pm
by FourthWorld
dunbarx wrote:Custom properties can hold a far larger variety of data than a variable
What can a custom property contain that a variable can't?
Re: Pass varible value through Custom Properties
Posted: Thu Sep 10, 2015 5:41 pm
by dunbarx
Richard.
You know, that was sloppy. I know that, say, setting a custom property to an image is the same as putting that image into a variable. The contents of each is the same, and what you can extract from each is also the same.
Craig