How could one create a table or list of buttons, such that clicking on a button removes the button itself from the list?
|
|
The crux of the problem is defining an identity for the buttons. As such a nice way is to keep them unevaluated in the list and define a structure to display them as buttons, this makes identifying them and deleting them simple:
The above images shows the state after #4 was clicked and deleted. Using this method, the list is quite simply the line:
Which is easy to handle and manipulate, and the buttons are just a visual representation of it. And it makes it very easy to put new buttons back, just run |
|||
|
|
|
Of course!
|
|||||||||
|
|
If you only want to remove one button, the solution is easy:
If you want to remove multiple unique buttons, you have to use some kind of identification for each button other than the actual position in the list, as that is changed when one of them is removed. Here I use a $position \rightarrow button$ identifier:
|
|||
|
|
