XRC panel updates?

Hi all,

I can create and display a panel from XRC no problem.

Now I want to go to the advanced stuff, I have defined several panels in
my XRC file and at some point I want to display one of the other panel
descriptions in its stead.

I already found out that simply doing a new LoadPanel with the same
parameters except for the object name does not work.
Same with a Destroy() on the result of the earlier LoadPanel action.

Now the panel is used as the content of a Notebook tab so that further
complicates matters, unless I am mistaken of course.

What is the way that does yield the desired effect?

Paul

···

--
Paul Sijben tel: +31334566488
Eemvalley Systems & Technology fax: +31334557523
the Netherlands http://eemvalley.com

Paul Sijben wrote:

Hi all,

I can create and display a panel from XRC no problem.

Now I want to go to the advanced stuff, I have defined several panels in
my XRC file and at some point I want to display one of the other panel
descriptions in its stead.

I already found out that simply doing a new LoadPanel with the same
parameters except for the object name does not work.
Same with a Destroy() on the result of the earlier LoadPanel action.

Now the panel is used as the content of a Notebook tab so that further
complicates matters, unless I am mistaken of course.

What is the way that does yield the desired effect?

It depends on the situation, but one way is to load all panels and Hide() the ones you don't need at the moment. When you need to switch then do a Show of the new one and a Hide on the old one. Depending on how you are doing your layout then you may need to do something to get the new panel sized and positioned right.

For notebook tabs you will need to remove the page from the notebook and insert the new one in it's place.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks I will try these tomorrow!

Robin Dunn wrote:

···

Paul Sijben wrote:

Hi all,

I can create and display a panel from XRC no problem.

Now I want to go to the advanced stuff, I have defined several panels in
my XRC file and at some point I want to display one of the other panel
descriptions in its stead.

I already found out that simply doing a new LoadPanel with the same
parameters except for the object name does not work.
Same with a Destroy() on the result of the earlier LoadPanel action.

Now the panel is used as the content of a Notebook tab so that further
complicates matters, unless I am mistaken of course.

What is the way that does yield the desired effect?

It depends on the situation, but one way is to load all panels and
Hide() the ones you don't need at the moment. When you need to switch
then do a Show of the new one and a Hide on the old one. Depending on
how you are doing your layout then you may need to do something to get
the new panel sized and positioned right.

For notebook tabs you will need to remove the page from the notebook
and insert the new one in it's place.

--
Paul Sijben tel: +31334566488
Eemvalley Systems & Technology fax: +31334557523
the Netherlands http://eemvalley.com

Hi I have been beginning to look at SWIG for wrapping some other wx functionality that is only in C at the moment to get some other things not currently available in wxPython. I have been interested in a some capability to interface with scanners with TWAIN. Robin, can you point me examples of wrapping wx functionality with SWIG in the repository anywhere so I have somewhat something to follow. Many thanks.

Regards,
David

Robin Dunn wrote:

···

Paul Sijben wrote:

Hi all,

I can create and display a panel from XRC no problem.

Now I want to go to the advanced stuff, I have defined several panels in
my XRC file and at some point I want to display one of the other panel
descriptions in its stead.

I already found out that simply doing a new LoadPanel with the same
parameters except for the object name does not work.
Same with a Destroy() on the result of the earlier LoadPanel action.

Now the panel is used as the content of a Notebook tab so that further
complicates matters, unless I am mistaken of course.

What is the way that does yield the desired effect?

It depends on the situation, but one way is to load all panels and Hide() the ones you don't need at the moment. When you need to switch then do a Show of the new one and a Hide on the old one. Depending on how you are doing your layout then you may need to do something to get the new panel sized and positioned right.

For notebook tabs you will need to remove the page from the notebook and insert the new one in it's place.

I have found the calls I’d need to remove the tab and recreate it.
However, is there a more elegant way of finding out the tab page number
of my panel besides looping over all numbers and calling `GetPage until it
returns the handle to my panel.

Paul

`

Robin Dunn wrote:

···
-- Paul Sijben tel: +31334566488
Eemvalley Systems & Technology fax: +31334557523
the Netherlands

http://eemvalley.com

Paul Sijben wrote:

I have found the calls I'd need to remove the tab and recreate it. However, is there a more elegant way of finding out the tab page number of my panel besides looping over all numbers and calling |GetPage until it returns the handle to my panel.

If you are always dealing with the current page then you can use GetSelection. Or you could make a dictionary when you add pages and use that to get back to the index.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks for all the help it works now. As I can not assume the panel is
active (I got asynchronous events all over the place in my app) and I do
not want to trust the dictionary (for the same reason), I just looped
over the tabs.

Robin Dunn wrote:

···

Paul Sijben wrote:

I have found the calls I'd need to remove the tab and recreate it.
However, is there a more elegant way of finding out the tab page
number of my panel besides looping over all numbers and calling
>GetPage until it returns the handle to my panel.

If you are always dealing with the current page then you can use
GetSelection. Or you could make a dictionary when you add pages and
use that to get back to the index.

--
Paul Sijben tel: +31334566488
Eemvalley Systems & Technology fax: +31334557523
the Netherlands http://eemvalley.com