The simplest way to go would be setting box(box_state) to "1" after clicking on a box.
Then, when drawing the boxes, after checking if id$ = "", check if the box(n) = 0 before drawing the box.
Another approach would be reading the data only once at the start of the program, and create a type for the boxes. You can than delete a instance from the type to delete a box.
Then, when drawing the boxes, after checking if id$ = "", check if the box(n) = 0 before drawing the box.
Another approach would be reading the data only once at the start of the program, and create a type for the boxes. You can than delete a instance from the type to delete a box.