Ignore:
Timestamp:
Mar 22, 2018, 8:31:19 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Update Common and CollTranslator packages to fix build under Lazarus 1.8.
  • Fixed: Some memory leaks.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormRecords.pas

    r13 r15  
    145145var
    146146  I: Integer;
    147   NewColumn: TListColumn;
    148147begin
    149148  Table.LoadRecords;
    150   ListView1.Columns.Clear;
     149
     150  ListView1.Columns.BeginUpdate;
     151  while ListView1.Columns.Count > Table.Fields.Count do
     152    ListView1.Columns[ListView1.ColumnCount - 1].Free;
     153  while ListView1.Columns.Count < Table.Fields.Count do
     154    ListView1.Columns.Add;
    151155  for I := 0 to Table.Fields.Count - 1 do begin
    152     NewColumn := ListView1.Columns.Add;
    153     NewColumn.Caption := TField(Table.Fields[I]).TextBefore;
    154     NewColumn.Width := 200;
     156    ListView1.Columns[I].Caption := TField(Table.Fields[I]).TextBefore;
     157    ListView1.Columns[I].Width := 200;
    155158  end;
     159  ListView1.Columns.EndUpdate;
    156160
    157161  ListView1.Items.Count := Table.Records.Count;
Note: See TracChangeset for help on using the changeset viewer.