setProp and Lock messages
m.schonewille at economy-x-talk.com
Sat Dec 3 10:16:44 CST 2011
I don't quite understand your question. Surely, it is a good idea to use getProp and setProp handlers. You just need to make sure not to get trapped in a loop, but this applies to all messages. Sometimes, there is a danger that setting a property calls the setProp handler again, but locking messages prevents this from happening. A correct handler may look like this:
setProp cProp x
set the cProp of the target to compress(x)
return decompress(the cProp of the target)
You need to lock messages if the target is an object on a card and the handler is at card or script level, or if the target is the card and the script is at stack level for instance.
Economy-x-Talk Consulting and Software Engineering
Become our partner in sales http://qery.us/1bq Start selling Color Converter today. 20% commission!
On 3 dec 2011, at 17:04, Todd Geist wrote:
> I understand that SetProp and GetProp handlers are messages and if Lock
> messages is on then these will not work. But clearly people use GetProp
> and SetProp handlers. I see them used a lot in CustomControls. I assume the
> DataGrid uses them when you "set dgData of "….
> So I am looking for clarification. When is it bad idea to use GetProp and
> SetProp handlers?
More information about the use-livecode