I have a frame with multiple panels inside.
One panel contains wxChoice.
Another panel contains set of wxSliders.
When user will select another thing by clicking wxChoice, number of sliders should change.
For instance, when user will select first choice, there should be 9 sliders visible, but when user will select second choice, there should be 12 sliders visible.
I coded it this way:
1) when user will change choice, I remove sliders from Sizer with Detach
2) I also destroy them with delete
3) then I add new sliders to Sizer
4) then I call Layout() on panel
I tried different combinations of Layout(), Fit() on panel and parent windows.
But I am never able to make the panel change its size after number or sliders will change.
So when there is 9 sliders at the beginning and I create 12 sliders - the window size stay the same.
What is recommended way to change the panel content on fly and how to make window fit new size?
How to change panel content on fly?
-
- Knows some wx things
- Posts: 38
- Joined: Mon Jun 20, 2011 12:03 pm
-
- Knows some wx things
- Posts: 38
- Joined: Mon Jun 20, 2011 12:03 pm
-
- Knows some wx things
- Posts: 38
- Joined: Mon Jun 20, 2011 12:03 pm
-
- In need of some credit
- Posts: 8
- Joined: Wed Jun 29, 2011 11:33 am
Re: How to change panel content on fly?
use wxCardSizer.
There is an AddCard function to which you can add your new GUI(as a panel or any control).
Then you can call panel or GUI of your choice by ShowCard(int).
Go for this if GUI is so complicated for show/hide.
Else go for show/hide.
There is an AddCard function to which you can add your new GUI(as a panel or any control).
Then you can call panel or GUI of your choice by ShowCard(int).
Go for this if GUI is so complicated for show/hide.
Else go for show/hide.