Ignore:
Timestamp:
Nov 24, 2021, 7:34:57 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Use fgl and generics instead of contnrs and TObjectList.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        66*.res
        77vCardStudio.exe
         8vCardStudio.dbg
  • trunk/Forms/UFormFindDuplicity.pas

    r23 r29  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ExtCtrls, StdCtrls, ActnList, Menus, Contnrs, UContact;
     9  ExtCtrls, StdCtrls, ActnList, Menus, fgl, UContact;
    1010
    1111type
     
    2222  { TFoundItems }
    2323
    24   TFoundItems = class(TObjectList)
     24  TFoundItems = class(TFPGObjectList<TFoundItem>)
    2525    function SearchByField(Field: string): TFoundItem;
    2626  end;
     
    4747    FContacts: TContacts;
    4848    procedure SetContacts(AValue: TContacts);
    49 
    5049  public
    5150    FoundItems: TFoundItems;
     
    5958  FormFindDuplicity: TFormFindDuplicity;
    6059
     60
    6161implementation
    6262
     
    8989destructor TFoundItem.Destroy;
    9090begin
    91   Contacts.Free;
    92   inherited Destroy;
     91  FreeAndNil(Contacts);
     92  inherited;
    9393end;
    9494
     
    118118end;
    119119
    120 function FoundItemsSort(Item1, Item2: Pointer): Integer;
    121 begin
    122   if TFoundItem(Item1).Contacts.Count < TFoundItem(Item2).Contacts.Count then Result := 1
    123   else if TFoundItem(Item1).Contacts.Count > TFoundItem(Item2).Contacts.Count then Result := -1
     120function FoundItemsSort(const Item1, Item2: TFoundItem): Integer;
     121begin
     122  if Item1.Contacts.Count < Item2.Contacts.Count then Result := 1
     123  else if Item1.Contacts.Count > Item2.Contacts.Count then Result := -1
    124124  else Result := 0;
    125125end;
     
    206206procedure TFormFindDuplicity.FormDestroy(Sender: TObject);
    207207begin
    208   FoundItems.Free;
     208  FreeAndNil(FoundItems);
    209209end;
    210210
Note: See TracChangeset for help on using the changeset viewer.