Using RadioButtons when you create and destroy windows

I’ve run into an issue when using RadioButton’s with Glide.

In my design I create Windows on the fly and the previous window gets destroyed.

So far this has worked great with all of the components on the form except today when I added the RadioButtons for the first time.

Glide creates a RadioButton manager which handles the groups. Trouble is that this list does not get destroyed when the window closes because it is not tied to the window itself.

When you open the window for the first time, the RadioButtons get created and you can click and toggle them on and off in groups as they should. If I now exit that window, all the controls are destroyed along with the bitmaps for it but the group still persists so when I open that Window again it detects that the group name is already present and simply adds the new button to the list, only now it is sitting way below the original buttons in that group.

So now when you click on a button you get an except that says the bitmap is destroyed which is the case with the original handler.

Looks like I need to add a function to clean up the groups prior to creating the window. No big deal as it won’t affect any normal use of Glide.