getProp Parameters

Monte Goulding monte at sweattechnologies.com
Fri Aug 1 03:26:01 EDT 2003


> According to the 'What's New in version 2.0-2.0.2' section of the Rev 
> documentation:
> 
> "(...) parameters in an 'on', 'setProp', 'getProp', or 'function' 
> control structure can no longer have the same name as a built-in 
> property or function."
> 
> My query is in regards to the 'getProp' portion of this sentence. I 
> thought that 'getProp' handlers were called only when a user/script 
> tried accessing a custom property. If so, how can a parameter be passed 
> when the getProp is called?
> 
> Not long ago, I wanted to do exactly that - be able to pass a parameter 
> to a getProp handler, so that based on the parameter passed, a 
> different value would be returned. The property was a 'virtual 
> property' of a group, and the group was supposed to query one of its 
> children to get the appropriate property. I had to end up using 
> *several* virtual properties - one for each child of the group - 
> because I could not figure a way to pass a parameter to the 'getProp' - 
> even though it sounds as if I should have been able to...
> 
> Does anyone know what the story is? Is this just an error in the 
> documentation, or is there really a way to pass a parameter to a 
> 'getProp'?
> 
Hi Igor

You can't pass a parameter but you can do this:

-- I guess this is what's meant by a getprop parameter
getProp cProperty pIndex 
  switch pIndex
    ...
  end switch
end cProperty

Then you use the following code to get the property:

put the cProperty[pIndex] into tProperty

Cheers

Monte



More information about the use-livecode mailing list