wxGrid background color extends to outside of grid display

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

wxGrid background color extends to outside of grid display

Post by spflanze »

I have a white area extending out from under my wxGrid display as shown in the attached image. How can I keep the white area confined to within the grid and inside the units column?
wxGrid BG Color Bleed.png
wxGrid BG Color Bleed.png (3.58 KiB) Viewed 1175 times
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7479
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGrid background color extends to outside of grid display

Post by ONEEYEMAN »

Hi,
As a workaround you can set a background color for the grid.
Or if you know how big the grid will be you can calculate its size and set it after constructing it.

Or hopefully someone else will have another (and better) idea.
Nunki
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 235
Joined: Fri Sep 14, 2012 8:26 am
Location: Kontich, Belgium
Contact:

Re: wxGrid background color extends to outside of grid display

Post by Nunki »

Hi Spflanze,

To my knowledge the white area is in the grid, meaning you don't have a border on your grid. The borders you see are simply the borders of the cells. Or, you have a panel with a white background on which you placed a wxGrid. The reason why I believe it's the first and not the latter is because of the grey area on the left beneath the cells. That's the label area. And since it goes down all the way, I think your grid does also. So you could set the background for your grid to be gray, like the label area, but I prefer using white or a color - not grey - to make the distinction between the content area of the grid and the side areas like labels and titles.

regards,
Nunki
spflanze
Earned some good credits
Earned some good credits
Posts: 130
Joined: Tue Feb 15, 2011 10:02 pm

Re: wxGrid background color extends to outside of grid display

Post by spflanze »

On all the grids I have in the Properties tab all Border check boxes checked. Is this the border you are referring to?

For the grid I attached I found I was able to eliminate the undesired white area underneath by unchecking the grid's expand property. But I have other grids where this undesired white area extends to the right instead of underneath, and for which unchecking the Expand checkbox did not work to eliminate. What did work was to set each of these grids's proportion values to zero.
Post Reply