Changeset 29 for trunk/Forms


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:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

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

    r23 r29  
    8787var
    8888  FormContact: TFormContact;
     89
    8990
    9091implementation
  • trunk/Forms/UFormContacts.pas

    r23 r29  
    4343    FContacts: TContacts;
    4444    procedure SetContacts(AValue: TContacts);
    45 
    4645  public
    4746    property Contacts: TContacts read FContacts write SetContacts;
  • 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
  • trunk/Forms/UFormGenerate.pas

    r23 r29  
    2121    procedure FormCreate(Sender: TObject);
    2222    procedure FormShow(Sender: TObject);
    23   private
    24 
    2523  public
    2624    Contacts: TContacts;
     
    3028var
    3129  FormGenerate: TFormGenerate;
     30
    3231
    3332implementation
Note: See TracChangeset for help on using the changeset viewer.