Storing objects in custom properties

Jim Ault JimAultWins at yahoo.com
Fri Mar 30 16:12:36 EDT 2007


On 3/30/07 12:33 PM, "Ian McKnight" <iangmcknight at googlemail.com> wrote:
> I have a number of groups containing a varying number of fields, ie 1
> group would have 6 fields, another group 35 fields and yet another 50
> fields. I want the user to be able to select any of these groups they
> wish and place them on a card.
> 
> My initial thought was to store the groups on a separate card and copy
> the chosen group as required or hide them on the same card  but then I
> thought 'Why not put them into custom properties?'
> 
> My problem is that I can't get it to work. I can put values, images,
> files into custom props but not groups or field objects. Have I, as I
> suspect, come across one of the few things that you can't put into a
> custom prop or am I missing something?

Custom  properties are like a table of values.. the "key" is the row label,
and the element is the stored data.  The stored data can be a string, image
data, a binary file (such as an app, a stack,  any file located on the hard
drive, etc.)

Your issue is that you need to convert the group or set of fields to a
single binary string of characters, and I would not know how to do that.

Step back a moment, and look at what groups are... If you have 3 fields and
one button defined as a group "userInput", this definition is stored in the
stack, and can be placed on a card, or not.  It is not necessary for the
group to appear on any of the cards, but it could appear on all of them.

The group can be hidden/shown, can be relocated off the screen, can be put
moved to a layer behind another object,  can be removed from the card.
Removing from the card will destroy the data in the fields, so place-remove
may not be a good option.

Now consider that custom properties are essentially an array of stored and
labeled values.  Trying to store a group in a custom property is kind of
like trying to put two feet in a single shoe.

It would be better to allow the user to show and hide groups that are
already on the card.  This would keep any data entry stored with the card.

If I am not understanding custom properties correctly, let the corrective
lessons commence :-)

Jim Ault
Las Vegas







More information about the use-livecode mailing list