Or, create a system that stores which buttons you still need on a panel and which you don't. You can hide the obsolete ones by giving them emtpy bitmaps and NULL-pointers as function. Then, when you create a new button, just overwrite an obsolete one.