Im having the toughest time trying to have a grid within a collapsed pane
Also with the collapsed pane it resizes the window each time someone clicks on it. I used wxCP_NO_TLW_RESIZE to stop resizing but then the data within the collapsed pane does not show
This is what I have so far. I would like the bottom grid to be in the collapsed pane labeled detailsI need help integrating collapse pane with a grid
Re: I need help integrating collapse pane with a grid
Hi,
Usual stanza:
1. What is your OS/version?
2. What is your version of wxWidgets?
3. Did you try to do that in a sample?
Thank you.
Usual stanza:
1. What is your OS/version?
2. What is your version of wxWidgets?
3. Did you try to do that in a sample?
Thank you.
Re: I need help integrating collapse pane with a grid
1. What is your OS/version?
Windows 7 64-bit operating system
2. What is your version of wxWidgets?
3.1.0
3. Did you try to do that in a sample?
No i have not ive been using samples as a reference
Windows 7 64-bit operating system
2. What is your version of wxWidgets?
3.1.0
3. Did you try to do that in a sample?
No i have not ive been using samples as a reference
Re: I need help integrating collapse pane with a grid
I am probably missing something as this super simple example works as expected
Obviously, in a real application if you do not wish the frame to expand you need to use a scrolled window (wxScrolled) to ensure all controls can be always accessed, regardless of the frame size and the number of rows in the grids...
Code: Select all
#include <wx/wx.h>
#include <wx/grid.h>
#include <wx/collpane.h>
class MyFrame : public wxFrame
{
public:
MyFrame() : wxFrame(NULL, wxID_ANY, _("Grid "), wxDefaultPosition, wxSize(600, 400))
{
wxPanel* mainPanel = new wxPanel(this, wxID_ANY);
wxGrid* mainGrid = new wxGrid(mainPanel, wxID_ANY);
mainGrid->CreateGrid(6, 10);
wxCollapsiblePane *collpane = new wxCollapsiblePane(mainPanel, wxID_ANY, "Details:",
wxDefaultPosition, wxDefaultSize, wxCP_DEFAULT_STYLE | wxCP_NO_TLW_RESIZE);
wxGrid* detailsGrid = new wxGrid(collpane->GetPane(), wxID_ANY);
detailsGrid->CreateGrid(6, 5);
wxSizer *collPaneSizer = new wxBoxSizer(wxVERTICAL);
collPaneSizer->Add(detailsGrid, 1, wxGROW | wxALL, 5);
collpane->GetPane()->SetSizer(collPaneSizer);
collPaneSizer->SetSizeHints(collpane->GetPane());
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add(mainGrid, 0, wxGROW | wxALL, 5);
mainSizer->Add(collpane, 0, wxGROW | wxALL, 5);
mainPanel->SetSizer(mainSizer);
}
};
class MyApp : public wxApp
{
public:
virtual bool OnInit()
{
(new MyFrame())->Show();
return true;
}
}; wxIMPLEMENT_APP(MyApp);