setProp question
Bob Sneidar
bobsneidar at iotecdigital.com
Tue Oct 16 11:12:27 EDT 2018
Not to mercilessly flog an expired Equine, but one of the great things about custom properties, is that you can pass the long ID of an object to a command or function (think behaviors), and so reference it's custom properties in said command or function. Essentially this behaves as group of variables with the object as the scope.
For instance I have a command that pops up a "tooltip" (not a real tooltip but a field) when I right-click a record in a datagrid, containing summary information about the record clicked on. How do I know what columns belong in the summary data? I store them in a custom property in the datagrid, then pass the long id of the datagrid to the command.
Think about that. Not only do I have the long ID of the datagrid, but also the long ID of the group (if any) the datagrid belongs to, the long id of the card, and the stack reference. Then I can reference all the regular and custom properties and know I am dealing with exactly that object clicked on, and not a copy of the object I forgot to delete. Just by passing the long ID, instead of a string of parameters. It's like a package of variables, AND the variables are persistent between sessions.
Bob S
> On Oct 16, 2018, at 04:13 , Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> I don't know of a way to intercept them, and I did look, because I have/had exactly the same problem.
>
> I wrote a script (ExplicitProperties) which does a decent, but imperfect, attempt to find places you have referenced a customprop, and checks whether it is a "known" one. That was back in 2012, and I haven't used it much in the meantime, so I don't know what the latest ersion of LC it has been tested / used with - but it was useful to me then.
>
> You can find it at http://www.tweedly.org/showpage.lc?page=ExplicitProperties with an explanation of what it does.
>
> So, you very reasonably ask, why does the author no longer use it ? :-)
>
> Well, I just gave up on using custom properties completely. Probably not the right thing to do, but it works for me.
>
> Alex.
More information about the use-livecode
mailing list