Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxGrid: Column resizing with sizers objects

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxGrid: Column resizing with sizers objects
#2401
Posted by: 2003-07-21 16:37:45
Hello
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
advance!

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);
gridtest->UpdateDimensions();
//
kontaktgrid->Add(gridtest, 0, wxGROW | wxCENTER, 10);
topsizer->Add(kontaktgrid, 0, wxEXPAND | wxALL | wxCENTER, 10);
panel->SetAutoLayout(TRUE);
SetSizer( topsizer );
Message2. Re: wxGrid: Column resizing with sizers objects
#2404
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
#2405
Posted by: guidance 2003-07-23 21:19:56
I think so.
Message4. Re: Yes
#2410
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
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2023-1-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0