GridCellRenderer GetBestSize

I’m trying to set a custom PyGridCellRenderer for my grid, but I’ve noticed that the GetBestSize(self, grid, attr, dc, row, col) method never gets called, while the Draw method is getting called fine.
Is this a known bug in the stable version ?

I found a fix, but it is ugly and slow, it seems that I need to call AutoSizeColumns(True) and AutoSizeRows(True) every time new rows are added to the grid. Is this intended behavior ?

···

On Tuesday, 25 June 2013 09:29:43 UTC+3, Alexandru Popa wrote:

I’m trying to set a custom PyGridCellRenderer for my grid, but I’ve noticed that the GetBestSize(self, grid, attr, dc, row, col) method never gets called, while the Draw method is getting called fine.
Is this a known bug in the stable version ?

Alexandru Popa wrote:

I found a fix, but it is ugly and slow, it seems that I need to call
AutoSizeColumns(True) and AutoSizeRows(True) every time new rows are
added to the grid. Is this intended behavior ?

IIRC it is only when trying to do things like an autosize operation that the grid needs to get the best size from the renderer, so yes it is probably intended. Although you could probably save some time by not autosizing all of the rows and columns each time and just AutoSizeRow and/or AutoSizeColumn for the specific row or col that needs it. Otherwise you could manage the row/col sizes yourself in some other way.

···

--
Robin Dunn
Software Craftsman