Discussion:
Reusing notebook pages?
Cees de Groot
2006-07-19 15:18:01 UTC
Permalink
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...).
Steven Swerling
2006-07-19 15:18:01 UTC
Permalink
Post by Cees de Groot
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?
Rob Gayvert
2006-07-19 15:18:01 UTC
Permalink
Post by Steven Swerling
Post by Cees de Groot
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.
Cees de Groot
2006-07-19 15:18:01 UTC
Permalink
Post by Rob Gayvert
As long as you use #removePage: instead of #deletePage: this should
work.
I'll try that, thanks.

Loading...