Enabling a Menu
Jim Ault
JimAultWins at yahoo.com
Sun Mar 25 13:31:33 EDT 2007
On 3/25/07 9:44 AM, "Joe Lewis Wilkins" <pepetoo at Cox.Net> wrote:
> Thanks for the added info, Jim. I'm not 100% sure that I really like
> all of this added functionality, what with the attended downsides,
> but guess I don't have much of a choice.
>
> 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