Here is an example:
function listDatagrids pObject
local dataGridList
repeat with i=1 to the number of groups of pObject
if grp i of pObject is a datagrid then -- fix this line
put whatever data on the datagrid & return after dataGridList --
fix this line
else
put listDataGrids(long ID of grp i of pObject) into childList
if childList is not empty then put childList & return after
dataGridList
end if
end repeat
return dataGridList
end listDataGrids
there are 2 lines you need to fix - one is how to tell a grp is a
datagrid. I recall a property or API you can check, but didn't have the
datagrid PDF handy.
The other is whatever info (short name, long ID, etc. you want for each
datagrid
Call it with the long id of the card. As in:
put listDatagrids(long id of cd x of stack y) into myListOfDatagrids
On 10/4/2016 3:16 PM, Bob Sneidar wrote:
> Hi all.
>
> Some time back someone had the need to enumerate every datagrid on a card
> even if the datagrids were themselves grouped with other objects. I cannot
> now find that thread, or any stack treating the issue in my downloads folder.
> It would involve recursion because the groupnames is a property of a card and
> not another group. If groups had the groupname properties it would be easy.
>
> As it is I then have to enumerate all groups and do recursive calls passing
> the current group as the next group to enumerate. If none of that makes sense
> just think, "42".
>
> My trouble is I am having a difficult time formulating the recursive
> function, and I cannot find recursion anywhere in the Livecode Lessons. I
> need an example of a recursive function.
>
> Bob S
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode