#1 2013-06-18 15:44:19

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

TSQLTableToGrid auto-resizing columns

I'm trying to set the column widths with the following code but SetFieldLengthMean doesn't appear to work (using XE2). Can anyone see what's wrong?

  Table.CalculateFieldLengthMean(colwidths);
  s := '';
  for i := 0 to length(colwidths)-1 do
    s := s + Chr(colwidths[i] + 64);
  Grid := TSQLTableToGrid.Create(DrawGrid, Table, nil);
  Grid.SetFieldLengthMean(s, false);

Offline

#2 2013-06-27 06:39:55

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TSQLTableToGrid auto-resizing columns

Just worked out that I needed to call TSQLTableToGrid.Refresh(true) after SetFieldLengthMean.

Offline

Board footer

Powered by FluxBB