Overriding Resize has a problem: an event will be raised not only when the mesh is actually resized , but also when the RowCount changes .
In one program, I needed to add / remove rows to the grid, as the user changed the grid size. In other words, I had to keep the grid filled with rows / data. However, the data was not available when I added / deleted rows.
So, I used this:
protected procedure WMSize(var Msg: TWMSize); message WM_SIZE; ..... Implementation procedure TMyGrid.WMSize(var Msg: TWMSize); begin inherited; if (csCreating in ControlState) then EXIT; { Maybe you also need this } { Don't let grid access data during design } ComputeRowCount; AssignDataToRows; end;
source share