Prev: libwxctb 0.8 fail to compile with gcc 3.4.4 (mingw version) on WinXP
Next: Assertion failure in wxSocket
From: Craig Kadziolka on 5 Jul 2006 21:11 Hi, I'm having a problem getting wxGrid to size its columns dynamically as the enclosing container is resized. Instead of working like I would expect it, there seems to be some blank area after the last column that I cant explain. Also, I have tried to suppress the horizontal scrollbar but it seems like wxGrid gives me one even if I dont specify wxHSCROLL. Is there any way to get rid of the horizontal scrollbar and/or remove this extra space after the last column? I am creating my grid like this: grid = new wxGrid( itemFrame1, ID_GRID1, wxDefaultPosition, wxSize(200, 150), wxSUNKEN_BORDER|wxVSCROLL ); grid->SetDefaultColSize(50); grid->SetDefaultRowSize(25); grid->SetColLabelSize(25); grid->SetRowLabelSize(0); grid->CreateGrid(3, 3, wxGrid::wxGridSelectCells); And when I get a size event for the enclosing frame, I execute this: void GridPanel::OnSize( wxSizeEvent& event ) { if (grid) { int width = grid->GetClientSize().GetWidth(); grid->SetColumnWidth(0, 30); grid->SetColumnWidth(1, 30); grid->SetColumnWidth(2, width - 60); } event.Skip(); } In my OnSize event handler I have tried using the frames client area instead of the grids but it seems to have the same (or similar) problems. Craig. --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: Guillermo Torreiro on 5 Jul 2006 23:28 Hi Craig, For your problem with the scrollbar, take a look at this link: http://groups.google.com.au/group/comp.soft-sys.wxwindows/browse_thread/thread/a197617d628e069/df63dcb511c7c2f4?q=wxGrid+::SetScrollBar&rnum=1&hl=en#df63dcb511c7c2f4 Regarding the problem with your last right column... I guess that you're better off using the OnSize() event but from the Frame where the grid is on (wxFrame::OnSize()). It seems that if you use the OnSize() event on the grid itself, then the event gets the "old" grid's size before the resizing and not the new size after the resizing, so I guess that's why you have that empty space. Hope that works, Best Regards, Guillermo --- Craig Kadziolka <craigk(a)virtualkaty.com> wrote: > Hi, > > I'm having a problem getting wxGrid to size its > columns dynamically as > the enclosing container is resized. Instead of > working like I would > expect it, there seems to be some blank area after > the last column that > I cant explain. Also, I have tried to suppress the > horizontal scrollbar > but it seems like wxGrid gives me one even if I dont > specify wxHSCROLL. > Is there any way to get rid of the horizontal > scrollbar and/or remove > this extra space after the last column? > > I am creating my grid like this: > > grid = new wxGrid( itemFrame1, ID_GRID1, > wxDefaultPosition, > wxSize(200, 150), wxSUNKEN_BORDER|wxVSCROLL ); > grid->SetDefaultColSize(50); > grid->SetDefaultRowSize(25); > grid->SetColLabelSize(25); > grid->SetRowLabelSize(0); > grid->CreateGrid(3, 3, > wxGrid::wxGridSelectCells); > > And when I get a size event for the enclosing frame, > I execute this: > > void GridPanel::OnSize( wxSizeEvent& event ) > { > if (grid) > { > int width = > grid->GetClientSize().GetWidth(); > > grid->SetColumnWidth(0, 30); > grid->SetColumnWidth(1, 30); > grid->SetColumnWidth(2, width - 60); > } > > event.Skip(); > } > > In my OnSize event handler I have tried using the > frames client area > instead of the grids but it seems to have the same > (or similar) problems. > > Craig. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > wx-users-unsubscribe(a)lists.wxwidgets.org > For additional commands, e-mail: > wx-users-help(a)lists.wxwidgets.org > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org
From: Milan Babuskov on 7 Jul 2006 11:44
Guillermo Torreiro wrote: > Regarding the problem with your last right column... I > guess that you're better off using the OnSize() event > but from the Frame where the grid is on > (wxFrame::OnSize()). It seems that if you use the > OnSize() event on the grid itself, then the event gets > the "old" grid's size before the resizing and not the > new size after the resizing, so I guess that's why you > have that empty space. Yes. I noticed the same problem. -- Milan Babuskov http://njam.sourceforge.net http://www.flamerobin.org --------------------------------------------------------------------- To unsubscribe, e-mail: wx-users-unsubscribe(a)lists.wxwidgets.org For additional commands, e-mail: wx-users-help(a)lists.wxwidgets.org |