I’m using TreeBook for a project in which I load hundreds or thousands of pages. Even though there are many pages added to the TreeBook, there are only a few ‘types’. Instead of creating hundreds of panels to add for each page, instead I create a blank panel for each type and assign that same panel to all pages of same type. I then dynamically update the content of the panel when the user selects the page.
This has worked well so far except for I’m adding the capability to delete pages from the list and I’m running into problems. TreeBook.DeletePage (and DeleteAllPages) appears to ‘destroy’ the panel too. So after I delete one page, I’m not able to view the other pages that have that same type because the panel is deleted.
So, I have a few questions on trying to solve this issue and would appreciate your input:
- Is there a direct way of deleting the page from TreeBook without destroying the panel? I find the destruction of the panel weird as TreeBook doesn’t itself create the panel (it only adds to the list).
- Change the panel for the page to None prior to deleting page. Unfortunately it doesn’t seem like there’s a way to set the panel of a page that is already created. Or is there?
- Is there a way to remove the page through TreeBook.TreeCtrl that does not mess up TreeBook’s bookkeeping of pages/panels?
- Is overwriting the panels (hypothetical) Destroy method to ignore the destruction in specific cases a way to go about it?
- Should I be using a different widget?