1. Add to the "Layers" demo an Action "removelayer"
2. Copy the code of the procedure Tfmain.btnRemoveClick and paste it in the action procedure
begin ImageEnView1.LayersRemove(); RefreshControls(); end;
3. Connect a popupmenu with the layermview and add the action to the menu
4. Run the demo and create some layers (for example 4)
5. Delete the top layer (#4) using the popup menu
The layer #4 will be removed but the error message "List index out of bounds (4)" appears. No error message appears when you remove another but the top layer or if you remove the layer #4 using the popup menu connected to the viewer.
Can you reproduce this behaviour and do you know a workaround in order to correct the error?