It exists a very efficient function : GetColumnByName
property ColumnByName[AValue:string]: TGridColumnItem read GetColumnByName;
Is it possible to add a new using the tag of the column ?
Function GetColumnByTag
property ColumnByTag[AValue:Integer]: TGridColumnItem read GetColumnByTag;
working when tag > 0 (of course)
function TAdvColumnGrid.GetColumnByTag(AValue: Integer): TGridColumnItem;
var
i: Integer;
begin
Result := nil;
IF AValue > 0 THEN
Begin
i := 0;
while i < Columns.Count do
begin
if Columns.Items[i].Tag = AValue then
begin
Result := Columns.Items[i];
Break;
end;
inc(i);
end;
end;
end;