Ignore:
Timestamp:
Dec 24, 2022, 7:17:24 PM (18 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package to latest version.
  • Modified: Build with Lazarus 2.2.4.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        66Tunneler.dbg
        77tunneler.lps
         8*.res
        89heaptrclog.trc
        910Components/Common/Languages/*.mo
        10 Components/CoolTranslator/Demo/lib
         11
  • trunk/Packages/Common/UListViewSort.pas

    r51 r54  
    22
    33// Date: 2019-05-17
    4 
    5 {$mode delphi}
    64
    75interface
     
    97uses
    108  {$IFDEF Windows}Windows, CommCtrl, LMessages, {$ENDIF}Classes, Graphics, ComCtrls, SysUtils,
    11   Controls, DateUtils, Dialogs, fgl, Forms, Grids, StdCtrls, ExtCtrls,
    12   LclIntf, LclType, LResources;
     9  Controls, DateUtils, Dialogs, Forms, Grids, StdCtrls, ExtCtrls,
     10  LclIntf, LclType, LResources, Generics.Collections, Generics.Defaults;
    1311
    1412type
     
    1917  TCompareEvent = function (Item1, Item2: TObject): Integer of object;
    2018  TListFilterEvent = procedure (ListViewSort: TListViewSort) of object;
     19
     20  TObjects = TObjectList<TObject>;
    2121
    2222  { TListViewSort }
     
    5252    {$ENDIF}
    5353  public
    54     List: TFPGObjectList<TObject>;
    55     Source: TFPGObjectList<TObject>;
     54    Source: TObjects;
     55    List: TObjects;
    5656    constructor Create(AOwner: TComponent); override;
    5757    destructor Destroy; override;
     
    149149destructor TListViewEx.Destroy;
    150150begin
    151   inherited Destroy;
     151  inherited;
    152152end;
    153153
     
    338338  ListViewSortCompare: TCompareEvent;
    339339
    340 function ListViewCompare(const Item1, Item2: TObject): Integer;
     340function ListViewCompare(constref Item1, Item2: TObject): Integer;
    341341begin
    342342  Result := ListViewSortCompare(Item1, Item2);
     
    349349  ListViewSortCompare := Compare;
    350350  if (List.Count > 0) then
    351     List.Sort(ListViewCompare);
     351    List.Sort(TComparer<TObject>.Construct(ListViewCompare));
    352352end;
    353353
     
    355355begin
    356356  if Assigned(FOnFilter) then FOnFilter(Self)
    357   else if Assigned(Source) then
    358     List.Assign(Source) else
     357  else if Assigned(Source) then begin
    359358    List.Clear;
     359    List.AddRange(Source);
     360  end else List.Clear;
    360361  if ListView.Items.Count <> List.Count then
    361362    ListView.Items.Count := List.Count;
     
    412413begin
    413414  inherited;
    414   List := TFPGObjectList<TObject>.Create;
    415   List.FreeObjects := False;
     415  List := TObjects.Create;
     416  List.OwnsObjects := False;
    416417end;
    417418
    418419destructor TListViewSort.Destroy;
    419420begin
    420   List.Free;
     421  FreeAndNil(List);
    421422  inherited;
    422423end;
Note: See TracChangeset for help on using the changeset viewer.