Reusing notebook pages?
Rob Gayvert
rtg at rochester.rr.com
Wed Mar 30 17:50:48 UTC 2005
Steven Swerling wrote:
> Cees de Groot wrote:
>
>> Hi,
>>
>> I have a UI with a tree on the left and depending on what's clicked
>> on the right, any number of notebook pages with various widgets
>> depending on the kind of item clicked on in the tree.
>>
>> At the moment, I send #deleteAllPages to the notebook and recreate
>> everything with every click on the tree. As I have some items with
>> fairly complex UI's and quite a bit of data, this takes too much time.
>>
>> What is a good way to make sure that view creation is done only once
>> per different notebook page?
>>
>> (I'm clueless about caching views with wxWindows. All I can come up
>> with is to create all notebook pages and selectively hide/display,
>> but this seems like a maintenance headache...).
>>
> Will "WxBookCtrl>>#insertPage:page:text:" help? It takes the desired
> page index, the page (panel) to insert, and the tab label for the page.
> So could you create all your pages at app startup, hold them in a iv,
> then use this call to insert them when they are needed? Or does deleting
> the page from the notebook blast the handle for that page?
As long as you use #removePage: instead of #deletePage: this should
work. In WxDemoFrame I'm doing something similar with the codePane. I
use #removePage: to hide it, then #addPage: to show it again, without
having to recreate it. However, I did have a lot of trouble with
flicker. The #freeze and #thaw methods are supposed to prevent display
updates, but they didn't seem to work for me.
More information about the Wxsqueak
mailing list