When using TStringGrid, I hide some columns in the Object Inspector. Then I want to get the count of visible columns by calling StringGrid.Columns.VisibleColCount, but the result is wrong because it counts the invivible columns.
Deep into the grids.pas, I found there is a defeine at the head of the file:
and the function:
function TGridColumns.GetVisibleCount: Integer;
{$ifNdef newcols}
var
i: Integer;
{$endif}
begin
{$ifdef newcols}
result := Count;
{$else}
result := 0;
for i:=0 to Count-1 do
if Items[i].Visible then
inc(result);
{$endif}
end;
The definition makes the function igoring Coulmn's Visible property.
Why?