Pass varible value through Custom Properties

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
shalu
Posts: 72
Joined: Fri Mar 20, 2015 1:05 pm

Pass varible value through Custom Properties

Post by shalu » Thu Sep 10, 2015 10:53 am

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 :roll:


--
Thanks,
Shalu S
--
Thanks
Shalu S

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Pass varible value through Custom Properties

Post by jmburnod » Thu Sep 10, 2015 11:32 am

Hi Shalu,
I want to pass this variable through Custom Properties is it possible
YES :D

Code: Select all

set the uMyCustom of control "mycontrol" to MyVariable
Best regards
Jean-Marc
https://alternatic.ch

shalu
Posts: 72
Joined: Fri Mar 20, 2015 1:05 pm

Re: Pass varible value through Custom Properties

Post by shalu » Thu Sep 10, 2015 12:01 pm

Hi

I have to place the code inside Property contents is it ok? please advise

Thanks
Shalu
--
Thanks
Shalu S

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Pass varible value through Custom Properties

Post by Klaus » Thu Sep 10, 2015 12:30 pm

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

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

Re: Pass varible value through Custom Properties

Post by dunbarx » Thu Sep 10, 2015 4:20 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Pass varible value through Custom Properties

Post by FourthWorld » Thu Sep 10, 2015 5:18 pm

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?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Pass varible value through Custom Properties

Post by dunbarx » Thu Sep 10, 2015 5:41 pm

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

Post Reply