Search code examples
c++11wxwidgets

How to get the propertygrid as big as sizer?


wxBoxSizer* bConstantsSizer;
bConstantsSizer = new wxBoxSizer( wxVERTICAL );

m_propertyGrid1 = new wxPropertyGrid(m_scrolledWindowConstants,wxID_ANY, wxDefaultPosition, wxSize(300, 300), wxPG_DEFAULT_STYLE|wxHSCROLL|wxVSCROLL);
bConstantsSizer->Add( m_propertyGrid1, 0, wxALL, 5 );

I have hardcoded the size of my property grid to 300, 300, but how do it dynamically?

Screenshot_20161221_015600.png


Solution

  • You need to set proportion to 1 and also set wxEXPAND flag for it, see sizeritem and sizeritembase properties. So the result should be

    bConstantsSizer->Add( m_propertyGrid1, 1, wxALL|wxEXPAND, 5 );