setProp and Lock messages

zryip theSlug zryip.theslug at gmail.com
Sat Dec 3 18:53:42 EST 2011


On Sat, Dec 3, 2011 at 7:01 PM, Todd Geist <todd at geistinteractive.com> wrote:

Hi Todd,

> More on this…
>
> I just tested locking messages prior to calling a handler that eventually
> sets the dgData of a DataGrid.  Of course no data is set into the Datagrid.
>
> Is this not a problem?

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




More information about the use-livecode mailing list