setProp and Lock messages

Todd Geist todd at geistinteractive.com
Sat Dec 3 19:17:27 EST 2011


Thanks for this explanation. I think I get most of the issues now.  I was
looking for a dividing line between when to use them and when not to use
them.  Of course the line isn't clear, but now I think I understand what to
watch out for.

I like using setProp and getProp. It feels right to me.  But I now
understand where this could lead to to trouble. In those cases where I feel
it is likely that locked messages may get in the way I will provide
Accessor methods.

Thanks again

Todd

On Sat, Dec 3, 2011 at 3:53 PM, zryip theSlug <zryip.theslug at gmail.com>wrote:

>
>
> Using the lock messages command with properties changes the scope of
> the properties from the virtual to the existing (or physical) state
>
> 1. Messages are unlocked and the control contains the corresponding
> property definition:
> getProp and setProp will be executed. In this case the property is virtual
>
> Example:
> set the dgData of grp "MyDatagrid"
>
> 2. Messages are unlocked and the corresponding properties definition
> not exists in the control.
> In this case this is a "physical" property you can access with the
> Inspector's "Custom properties" tab
>
> Example
> set the cDgData of grp "MyDatagrid"
>
> 3. Messages are locked and the corresponding property exists in the
> control.
> By locking the messages, you will change the scope of properties from
> the virtual state to the "physical" state
>
> Using:
>
> SetProp myProp pValue
>   lock messages
>   set the myProp of the target to pValue
> end myProp
>
> Will not only prevent a loop issue, but also is a good way to save the
> virtual property value, inside an object.
>
>
> By using:
> lock messages
> set the dgData of grp "myDataGrid" to tData
>
> We can say, according to the datagrid doc, that the dgData property
> will fail because the dgData will not be triggered by the datagrid
> engine.
> In my opinion, always be confident in the datagrid documentation and
> do not believe Mark when he says, you should not believe in the
> datagrid recommendations...
> Or point him out the documentation. 8-)
>
> http://lessons.runrev.com/s/lessons/m/datagrid/l/7340-What-Sorts-of-Things-Should-I-Not-Do-In-Order-To-Avoid-Needless-Suffering-
>
>
> You should check the custom properties of the datagrid group with the
> inspector. You should have now a dgData property inside it with all
> the data you tried to display. You should remove this dgData property,
> in the goal to keep your project free of useless data.
>
>
> Best Regards,
> --
> -Zryip TheSlug- wish you the best! 8)
> http://www.aslugontheroad.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Todd Geist


(805) 419-9382



More information about the use-livecode mailing list