Enabling a Menu

Joe Lewis Wilkins pepetoo at Cox.Net
Sun Mar 25 13:44:53 EDT 2007


Show off!  Just kidding, of course. Don't know when I'll ever get  
around to using this feature, but once I've digested it, I feel  
pretty sure that it's amazing qualities will hit me right between the  
eyes!

Thanks, Jim,

Joe Wilkins

> Custom properties are very fast, powerful, and get saved with the  
> stack.
> Variables, such as globals and script locals, evaporate, and are  
> not saved
> with the stack.  Custom properties have even more power when done  
> as custom
> property 'sets'.
>
> Think of custom properties as a table that can be stored inside an  
> object
> (like a button, card, stack).  The left column has the label ("  
> cpUserName
> ", " cpUndoValue ", " cpPrevRect ") and the right column has the  
> string that
> is the value.
>
> cpUserName "Paul"
> cpUndoValue "Red"
> cpPrevRect "34,56,788,675"
>
> Now add the concept that you can have unlimited tables stored in a  
> single
> button, card, stack by naming the tables
> -----copy script lines -----------
> on mousedoubleup
>
>   set the custompropertyset of this stack to "cpsPaulsData"
>   set the cpUserName of this stack to "Paul"
>   set the cpAge of this stack to "24"
>   set the custompropertyset of this stack to "cpsMarysData"
>   set the cpUserName of this stack to "Mary"
>   set the cpAge of this stack to "unknown"
>   save this stack  --does not work for standalones
>   set the custompropertyset of this stack to "cpsPaulsData"
>   answer "the user is "& the cpUserName of this stack  &  \
>       " whose age is "& the cpAge of this stack
>
>   set the custompropertyset of this stack to "cpsMarysData"
>   answer "the user is "& the cpUserName of this stack  &  \
>       " whose age is "& the cpAge of this stack
>
> end mousedoubleup
>
> ---------end copy script lines
>
> As you might have guessed, I use "cp" for my custom properties, and  
> "cps"
> for sets.
>
> This is basically a flat file database that can be stored in any  
> and all
> objects.  Very powerful and it is instant access speed.
>
> Jim Ault
> Las Vegas



More information about the use-livecode mailing list