wxSizer not working with image panel Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mybofy
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Aug 07, 2015 2:09 pm

wxSizer not working with image panel

Post by mybofy » Tue Sep 13, 2016 2:24 pm

Bonjour

The class wxImagePanel (https://wiki.wxwidgets.org/An_image_panel #A simple image panel) works well for me.

My class name for wxImagePanel is ImagePanel
In a parent panel ImagePanelDyn

Code: Select all

ImagePanel *imagePanel = new ImagePanel(this,...
OK, I see my image

But if I do

Code: Select all

wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
ImagePanel *imagePanel = new ImagePanel(this,...
sizer->Add(imagePanel, 0);
this->SetSizer(sizer);
No image displayed !!!
Some tries like this->Layout();, sizer->SetSizeHints(this); give nothing.

With wxStaticBitmap, the image is displayed in the case of wxSizer. Not usable for me because it is ... static (mouse events ignored)

What'is my errors ?

Merci

User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 429
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxSizer not working with image panel

Post by xaviou » Tue Sep 13, 2016 3:17 pm

Hi.
mybofy wrote:What'is my errors ?
You never tell to the sizers system what is the needed size of your panel.
So it surely have a 0px x 0px size.

You can make a call to SetMinSize on your ImagePanel to avoid this.

Regards

XAv'
My wxWidgets stuff web page : [email protected]'s wxStuff

mybofy
Knows some wx things
Knows some wx things
Posts: 29
Joined: Fri Aug 07, 2015 2:09 pm

Re: wxSizer not working with image panel

Post by mybofy » Tue Sep 13, 2016 4:53 pm

OK ! You are right.

I have to refine the dimensions.

Merci

Post Reply