Cell Control event handling

I've dynamically created a column of cell controls and an associated OnChange event handler:


for I:=1 to grid.RowCount-1 do
begin
grid.CellControls[1, I] := TAdvTrackBar.Create(Self);
(grid.CellControls[1, I] as TAdvTrackBar).OnChange := TrackBarChanged;
end;

Is this the best way to do it?

Also, how can my event handler determine which of the many trackbar controls fired the OnChange event?

Thanks!

You could use the AdvTrackBar.Tag to identify the control.

Perfect! Thanks again.