Centering a wxGrid on a wxFlexGridSizer

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
chris
I live to help wx-kind
I live to help wx-kind
Posts: 150
Joined: Fri Oct 08, 2004 2:05 pm
Location: Europe

Centering a wxGrid on a wxFlexGridSizer

Post by chris » Sun Dec 04, 2005 5:03 pm

Hi all,

I'm not sure if this belongs to "platform related", but I experience different behaviour on Windows and Linux, therefore I'll post this here.

I've got some troubles with centering a wxGrid in a wxFlexGridSizer.
The code fragment below successfully centers the grid with wxGTK 2.6.2, but fails to do so with wxMSW 2.6.2 -- the grid is horizontally aligned to the left.

Any ideas?

Code: Select all

//generated by wxDevCpp:

	wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(5,1,0,0);
	this->SetSizer(WxFlexGridSizer1);
	this->SetAutoLayout(TRUE);

//adding some other controls here to the sizer, wxALIGN_CENTER works
// for those.

	grid = new wxGrid(this, ID_GRID, wxPoint(9,179), wxSize(408,125),wxHSCROLL|wxVSCROLL|wxWANTS_CHARS);
	grid->SetDefaultColSize(75);
	grid->SetDefaultRowSize(18);
	grid->SetRowLabelSize(1);
	grid->SetColLabelSize(18);
	grid->CreateGrid(0,5,wxGrid::wxGridSelectCells);
	WxFlexGridSizer1->Add(grid,0, wxALIGN_CENTER|wxALL,0);
Compilers/settings:

Windows: Visual C++ 7.1, unicode static lib
Linux: GCC 4.02, unicode shared lib

TIA, Chris
this->signature=NULL;

Post Reply