Page 1 of 1

Custom Property Display

Posted: Mon Jan 21, 2013 9:10 pm
by bqsbarbqGAnC5Z
Hi Everyone,

I have a seemingly simple problem that I just can't seem to solve. I want to display a custom property that I have already defined in a field. I have tried the following as well as several iterations, but I just can't seem to get it to work.

Code: Select all

on preOpenCard
    put cProperty into field "property"
end preOpenCard
If you could offer any help, that'd be greatly appreciated! Thank you!

Re: Custom Property Display

Posted: Mon Jan 21, 2013 9:13 pm
by sturgis
First, you designate properties by using the keyword "the

the cwhateverproperty

And you have to tell the system where the property is located

put the cWhateverProtery of field "whateverfield" into.....

If the property is in the same object that contains the script, you can use "me" to locate the property

So if you have a button with a property, and you have a script in the same button to show the property you can do something like

put the cProperty of me into field "fieldname"

or if the property is in the current card or stack..

put the cProperty of this stack into field "fieldname"

Re: Custom Property Display

Posted: Mon Jan 21, 2013 9:24 pm
by bqsbarbqGAnC5Z
Wow that worked perfectly! Thanks for your help Sturgis!

Re: Custom Property Display

Posted: Tue Jan 22, 2013 3:05 am
by dunbarx
What Sturgis said.

You are probably familiar with and have already used native properties, no? Like "the textFont", "the backgroundColor" or "the loc"? Same thing with custom.

Look at your original construction: put cProperty into field "property"

Do you see this is identical to putting the contents of a variable (cproperty) into that field? There has to be a way for LC to tell the difference. The dictionary gives the syntax.

In that vein, you likely never actually set the property in the first place, since you have to do so explicitly with the word "set". Play around with these, though, as custom properties have enormous power, are fun, and can be used almost everywhere.

Craig Newman