Setting Custom Property syntax

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am

Setting Custom Property syntax

Post by Clarkey » Thu Jun 24, 2010 1:26 pm

Hi Folks, I'm building out some preferences on a card and want to use custom properties for persistence. I'm trying to understand Revolution's checkbox and custom property set/get syntax and would appreciate a simple example of how a card custom property can be set to reflect the hilite/non-hilite state of a checkbox on the card.
Thanks & regards,
Keith..

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: Setting Custom Property syntax

Post by bn » Thu Jun 24, 2010 2:12 pm

Hi Keith,

make a new stack with one checkbox button and a regular button.
script of checkbox button:

Code: Select all

on mouseUp
   set the uCheckBox of this card to the hilite of me
end mouseUp
script of the regular button:

Code: Select all

on mouseUp
   put the uCheckbox of this card
end mouseUp
toggle the checkbox button and the regular button will put the state of the checkbox button into the message box.

You are free as far as naming of the custom property is concerned as long as it is not a reserved word, many people in Rev use the prepended u to designate a custom property.
If you use an array in a custom property you first have to put the array out of the custom property into a variable, work with/on the array and set the custom property to the array again when your are done using it. Non-arrays can be accessed directly.
You can stuff anything you want into a custom property, binary data / whole stacks. One thing to watch out for is that because of this liberal format of the custom property: if you store text in a cp Rev will not automatically change the hight ascii values for you depending on the platform.
regards
Bernd

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

Re: Setting Custom Property syntax

Post by Klaus » Thu Jun 24, 2010 2:14 pm

Hi Keith,

"set" a custom prop:
...
set the cHiliteState of this cd to true/false
...
Or
...
set the cHiliteState of cd X to the hilite of btn Y of cd Z
...

"get" a cp:
...
put the cHiliteState of this cd into myVar
...
Or
set the hilite of btn X to the cHiliteState of this cd
...

You get the picture :)


Best

Klaus

P.S.
DAMN, noone can beat the sleeples monster a.k.a bn :D

Clarkey
Posts: 109
Joined: Fri Jun 11, 2010 11:10 am

Re: Setting Custom Property syntax

Post by Clarkey » Thu Jun 24, 2010 3:04 pm

Ah, thanks for the responses and enlightenment, gentlemen. I now see how set properties ≠ setProp!
I must improve my search strings! :?
Best,
Keith..

Post Reply