Page 1 of 1

Deleting the contents of a group using code

Posted: Thu May 14, 2020 12:41 pm
by andyh1234
I think this is a beginner level question that I'm really struggling with.

All I want to do is empty a group in code so I can repopulate it.

I have a 'complex (to me)' script that takes a template group and works through a loop to add instances of it into the master group. The problem is when I want to add an item I would just like to clear the master group and then re-run the build to repopulate it with the latest data.

Deleting all items in a group sounds simple but for the life of me I cannot work out the code to do it, all I want is the group I have called

group "grpScroller"

stays on the card, and it is empty read to take new data.

All the data I add to the group also group if that makes sense, I copy a template group into grpscroller, all that is working great, I just can't work out how to wipe the group clean ready for a new set of data.

Should be easy but I'm stuck.

Re: Deleting the contents of a group using code

Posted: Thu May 14, 2020 12:56 pm
by Klaus
Hi Andy,

this will do the trick:

Code: Select all

on mouseUp
   put the num of controls of grp 1 into tNum
   repeat with i = tNum down to 1
      delete control i of grp 1
   end repeat
end mouseUp
Best

Klaus

Re: Deleting the contents of a group using code

Posted: Thu May 14, 2020 1:14 pm
by andyh1234
Thank you!!!!