Scripting Question

StevePhelps shared this question 5 years ago
Answered

Any suggestions would be appreciated...


I have an image named pic1. I have it scripted so when I click on it, a copy is created named pic2. Click again and image pic3 is created. And so on...


After 10 clicks on pic1, I have 10 new images named pic2, pic3, ... , pic11.

I also have a counter created that keeps track of the number of time I have clicked on pic1.


What I am trying to do is this...Create a button that will delete these pic2, pic3, ... , pic11, regardless of the number if times I click on pic1


For example, if I click on pic1 five times, and create pic2, pic3, pic4, pic5, pic6, clicking on this button will delete pic 2 through pic6

Comments (3)

photo
1

Oh...I don't want to append them to a list and delete the list...I want the copied pics to be free to move about the screen.

photo
1

Execute[Sequence["Delete[pic"+k+"]",k,1,6]]


should do the trick.

photo
1

Ahhh...Thanks, Zbynek! I had my quotation marks in the wrong places!

© 2021 International GeoGebra Institute