Dumb Newbie Questions -- 1 of N

Peter Alcibiades palcibiades-first at yahoo.co.uk
Fri May 1 15:49:34 EDT 2009


Yes.  You just refer to your custom property as 'the xxx of yyy' where xxx is
the name you gave it, and yyy is either the stack or the card it is a
property of.  The script in which you do this can be associated with any
object or event in the stack.

For instance, say you had a POS system and you did employee discounts.  You
might have a button with 'DISCOUNT' on it, perhaps on the order entry card. 
Your script would just do something like, on mouseup multiply the price of
the item by - and here comes the custom property - "the discount of this
stack".  The button could be on any card.  Or the event could be any event
associated with the stack.  Like it could be on openCard - whichever card
would be appropriate.  When the card is opened, for instance, do something
which will show the user "the warning_message of this stack".

Then you could do all the usual things, if you want them to be able to
change the discount level, you just get what they want to use, and "put it
into the discount of this stack".  Or if you are keeping track of events,
you can, every time the event happens, put some record of it "after the
eventlog of this stack".

This is the funny thing that drove me nuts until I suddenly saw it - there
is nothing to this, its the simplest thing in the world.  You just create
yourself a custom property using the property inspector of the stack or the
card - or I guess other objects too, though I have never done this.  And
then you put things in them, get things from them, filter them.  Whatever.

In the above example, you'd open the stack property inspector, pick the
custom properties item from the pulldown menu, and just create it,  and then
put the discount percentage in it.  Bingo!

Password, for instance.  Ask for the password and then if what is supplied
"is the adminpassword of this stack" let them into the admin page, otherwise
answer sorry, we got to have the correct password for this.

Its not a property in any normal sense of the word.  Its just a sort of
special field.  Yes, its a special sort of global variable as well.

But I do have the feeling that when people try to explain this to new users,
they need to do it in terms that the user already understands.  If you have
done anything, you have used a field, read a field, written to it and so on. 
So tell someone to think of the custom property as a sort of field, and they
will probably get it.  Global variables, properties, all that stuff just
made it more opaque in the beginning.  For me,

If this is wrong, one of the gurus please correct.  This is an amateur
blundering through it!

Peter


Richmond Mathewson-2 wrote:
> 
> .... However, what is not clear to me
> is whether I can access data stored in the custom property
> of an object from a script in another, rather like the way I can
> access data stored in a field on a different card to the one
> I am 'calling' from.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/rev-dictionary-blocked-tp23316218p23338734.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list