wxGrid as child of wxSplitterWindow

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
jab121
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 25, 2005 12:05 pm

wxGrid as child of wxSplitterWindow

Post by jab121 » Tue Feb 01, 2005 4:11 pm

I have a wxSplitterWindow with two components (split vertically).
The first, (at the top) is a simple panel. The second (at the bottom) is a wxGrid.

Ive got a function to resize the wxSplitterWindow when its parent is resized. The same resize
function is used when I move the slider (sash?). Under Linux, no problems

Under Win32 though, if I pull the sash down and make the wxGrid component too small it corrupts.
Bizarrely, this doesn't happen if I resize the main window (even though the same resize function is being called).


I have tried lots of different things, such as catching the Size event and doing it manually. The size is changing
correctly as is the virtual size, its just that it gets corrupted beyond a certain size using the sash.
I have also tried making the bottom component a wxWindow and putting the wxGrid onto it as a child. Same thing happens.

Does anybody know of any issues with putting a wxGrid as a child of a wxSplitterWindow?

Thanks,
James

arkanes
Experienced Solver
Experienced Solver
Posts: 59
Joined: Sun Oct 17, 2004 12:05 am

Post by arkanes » Wed Feb 02, 2005 3:23 am

Add the FULL_REPAINT_ON_RESIZE style to the wxGrid.

jab121
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 25, 2005 12:05 pm

Post by jab121 » Wed Feb 02, 2005 3:13 pm

Thanks for the response,
From what I can see though, this style only exists in the beta version of wxWindows.

J

jab121
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 25, 2005 12:05 pm

Post by jab121 » Fri Feb 04, 2005 10:20 am

Im using version 2.4.2, so this style is the default, and hence already active.

It only seems to happen when the sash position is set too low. It doesn't seem to be related to the size of the wxGrid itself. Could it be perhaps an issue with the parent wxSplitterWindow instead?

Thanks
J

This is where I create the splitter and the subpanels. categoryPanel is the panel with the problems. It is at the bottom of the wxSplitterWindow and corrupts when the wxSplitterWindow sash is moved down too far.

Code: Select all

mainSplitter = new wxSplitterWindow(bgPanel, ID_MainSplitter, wxPoint(NOTEBOOK_WIDTH+10,5), wxSize(500,520));

categoryPanel = new wxCategoryPanel(mainSplitter, this, wxPoint(0,0), wxSize(700,300));
analysisPanel = new wxAnalysisPanel(mainSplitter, this, wxPoint(0,0), wxSize(400,300));

mainSplitter->SplitHorizontally(analysisPanel, categoryPanel);
mainSplitter->SetMinimumPaneSize(100);


categoryPanel contains a single widget, a wxGrid.  The resizing of this panel is handled here, which in turn resizes the wxGrid widget it contains (categoryTable).


void wxCategoryPanel::onResize(wxSizeEvent& event) {
	
	categoryTable->SetSize(event.GetSize());

}
This resize method gets called when I A) Resize the wxSplitterWindow, or B) Move the splitter window sash position.

The graph only corrupts when I move the splitter window sash position though.

EDIT: Please use the [ code ] tag forsyntax highlighting

jab121
Earned a small fee
Earned a small fee
Posts: 17
Joined: Tue Jan 25, 2005 12:05 pm

Post by jab121 » Fri Feb 04, 2005 1:11 pm

Ok, now I know the conditions for the problem to occur, although it hasn't as yet helped me find a solution.

When you pull the sash down, the grid moves down (because its in the bottom part of the splitter window) and the view area and the larger virtual area move down along with it.
When the virtual area of the grid crosses over the bottom of the screen the grid becomes corrupted.

This problem becomes more and more serious the larger my grid gets, because the virtual size gets bigger, even though the view size is the same.

Any ideas how to fix this?

Post Reply