getProp

Ken Ray kray at sonsothunder.com
Thu Mar 18 00:28:27 EST 2004


> Does anyone have a simple script that would show how 
> this is supposed to work and maybe a little list of 
> ideas for it's intended usage.

How about this: a button has a custom property called "age". Another button
has this script:

-- The script of btn 2
on mouseUp
  set the age of btn 1 to 100
end mouseUp


-- The script of btn 1
setProp age pValue
  if pValue > 100 then
    answer "Too old. The age will remain unchanged."
    exit age
  end if
  pass age
end age


A couple of things to note:

1) Note that the "handler name" is actually the name fo the custom prop
("age" in this case), and that the "end" is not "end setProp", it's "end
age".

2) If you don't pass the property name, it does not actually get set (see
the "if pValue" condition above).

3) You can change the value before you pass it, in which case it will get
the revised value. For example, if I were to add "put 60 into pValue" before
"pass age", the button would get the age of 60.

HTH,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list