> Neville Smythe via use-livecode Mon, 25 Oct 2021 20:20:34 -0700 wrote:
> 
> 4. BUT (annoyingly) this fails, giving an empty result:     put the 
> pArrayName[pElementName]  of button “button”
> 
> Why? If 3 works, I would have thought the parser would substitute values for 
> all variables before getting the property using  the “special coding”


This is not the answer to "Why?" but it sort of does what you want

-----------------------------
on mouseUp
   local tProperty, tValue, tTarget, tResult
   
   put "dropShadow" into tProperty
   put "color" into tValue
   put the long id of button "b1" into tTarget
   
   put fetchProperty(tProperty, tValue, tTarget) into tResult
   
   if the result is empty then
      answer "Property " & tProperty && tValue & " not found"
   else
      answer tProperty && tValue && tResult
   end if
end mouseUp

function fetchProperty pProperty, pValue, pTarget
   local tProp
   put the pProperty of pTarget into tProp
   if tProp is not an array then -- either single value (e.g. width) or empty
      return tProp
   else
      return tProp[pValue] -- either array value or empty
   end if
end fetchProperty
-----------------------------

Kind regards
Bernd
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to