if you don't want to wait, read the project browser code. On Fri, Jan 5, 2018 at 12:10 PM, Bob Sneidar via use-livecode < use-livecode@lists.runrev.com> wrote:
> Hi all. > > I put together a couple of handlers that will return all the objects on a > card in the form of an array whose elements are the objects names as a > return delimited list, the Long IDs as a return delimited list and an array > of the properties of each object which properties are passed in a > parameter. The syntax is: > > put getCardObjects(pCardID, "rect,visible,owner") into aCardObjects > > Set the second parameter to whatever properties you want returned. But > here's the problem. The owner property returns empty. It works fine when I > use the message box, but not in the script. That has to be a bug. Here is > the code. If someone can verify they have the same problem and it is not an > issue with my code, then I will post a bug report with a sample stack. > Nothing on the QCC I can find. Put the following in a button on any card > with objects: > > on mouseUp pButtonNumber > put getParentCard(the long id of me) into pCardID > put getCardObjects(pCardID, "rect,visible,owner") into aCardObjects > breakpoint > end mouseUp > > function getParentCard pObjectID > put offset("card id", pObjectID) into tStartChar > put char tStartChar to -1 of pObjectID into tCardID > return tCardID > end getParentCard > > function getCardObjects pCardLongId, pPropList > repeat with i = 1 to the num of controls in pCardLongId > put the long id of control i of pCardLongID into tControl > put the name of tControl into tControlName > > switch > case the dgProp ["control type"] of tControl is "data grid" and \ > the dgProp ["control type"] of the owner of tControl is > "data grid" > next repeat -- This is a control of a datagrid. We only want the > datagrid itself. > break > case the dgProp ["control type"] of tControl is "data grid" and \ > not (the dgProp ["control type"] of the owner of tControl is > "data grid") > -- this is a datagrid > add 1 to tCounter > getObjectProps tControl, tControlName, tCounter, pPropList, > aObjectData > put tControlName & cr after tObjectNames > put tControl & return after tTempObjectList > next repeat > break > end switch > > -- what remains is a field, button or graphic object > add 1 to tCounter > getObjectProps tControl, tControlName, tCounter, pPropList, aObjectData > put tControlName & cr after tObjectNames > put tControl & return after tTempObjectList > end repeat > > put tObjectNames into aObjects ["names"] > put tTempObjectList into aObjects ["IDs"] > put aObjectData into aObjects ["props"] > return aObjects > end getCardObjects > > on getObjectProps pControl, pControlName, pIndex, pPropList, @aObjectData > repeat for each item tProp in pPropList > put the tProp of pControl into aObjectData [pIndex] [pControlName] > [tProp] > end repeat > end getObjectProps > _______________________________________________ > 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 > -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, "This is good." _______________________________________________ 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