Autosizing columns event question

Hello,

I wnt to make my grid like spreadsheets, so if you double left click the right hand edge of a header cell, it resizes the column based on max cell below width.

Initially I thought I could bind to EVT_GRID_LABEL_LEFT_DCLICK but this seems to be for clicking within the label area, and not on the edge.

Googling / reading Robin’s book hasn’t shown a solution. Is there a better event to bind to?

TIA

MarkL

Mark Livingstone wrote:

Hello,

I wnt to make my grid like spreadsheets, so if you double left click the
right hand edge of a header cell, it resizes the column based on max
cell below width.

Initially I thought I could bind to EVT_GRID_LABEL_LEFT_DCLICK but this
seems to be for clicking within the label area, and not on the edge.

Googling / reading Robin's book hasn't shown a solution. Is there a
better event to bind to?

There isn't a grid event for it, but you could intercept the lower level mouse events for the label windows by binding to grid.GetGridColLabelWindow() and/or grid.GetGridRowLabelWindow() and checking for label border clicks there. Be sure to call evt.Skip() for those events that you want the grid to continue to process as it already does.

···

--
Robin Dunn
Software Craftsman