Guidance Forums / wxWidgets (wxWindows) in C++ / wxGrid: Column resizing with sizers objects

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxGrid: Column resizing with sizers objects
Posted by: 2003-07-21 16:37:45
I am using wxWindows since a few weeks and for my GUI, I need to
display a grid inside a wxStaticBox object.
I want the following: when the user resize the window, and especially
sizes up the width, I would like all columns to expand in order to fit
the new frame width. For now I have a grid with some columns of a
certain size and on frame resizing, just a white square (like the grid
background) is scaling up, not the columns that keep their width!
I have tried with wxLayoutConstraints and wxSizers objects and I did
not find any solution. Always this ugly white square!
It's a big problem for me and I think the people who are using
wxWindows for a long time must know the solution. Thanks you in

Here is my code:

wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *kontaktgrid = new wxStaticBoxSizer(new wxStaticBox(panel,
-1, _T("Query Services List")), wxHORIZONTAL);

//if the width is -1 then the grid is not visible because it does not fill the frame width!
wxGrid *gridtest = new wxGrid(panel, -1, wxDefaultPosition, wxSize(-1, 220));
gridtest->CreateGrid(10, 5);
kontaktgrid->Add(gridtest, 0, wxGROW | wxCENTER, 10);
topsizer->Add(kontaktgrid, 0, wxEXPAND | wxALL | wxCENTER, 10);
SetSizer( topsizer );
Message2. Re: wxGrid: Column resizing with sizers objects
Posted by: 2003-07-23 17:43:04
just another question, do I have to use an underlying table to be able to sort the columns in the grids? I also want to refresh some data, so perhaps it is easier with a table.
I wait your comments, thanks in advance!
Message3. Yes
Posted by: guidance 2003-07-23 21:19:56
I think so.
Message4. Re: Yes
Posted by: 2003-07-25 21:42:42
thanks, but for my first post, is it possible or not to make the columns fit the frame's width ?
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Mon 2024-6-17  Guidance Laboratory Inc. Hits:0