Shrink wxGrid height to last row
Shrink wxGrid height to last row
I have a grid created through wxGrid that can display n rows, if I fill it with a smaller number of rows how can I shrink the height of the wxGrid so that the bottom edge coincides with the last row ?
Re: Shrink wxGrid height to last row
First you need to calculate the height needed. That would be the height of all rows ( wxGrid::GetRowSize() ) plus the height of the column header window, if there is one ( wxGrid::GetGridColLabelWindow() ).
Then you set mininum, maximum and current size to the size you calculated. If you're using sizers (as you should), call Layout() afterwards.
Then you set mininum, maximum and current size to the size you calculated. If you're using sizers (as you should), call Layout() afterwards.
Use the source, Luke!