Changeset 77 for trunk/UContact.pas


Ignore:
Timestamp:
Dec 15, 2021, 9:03:17 PM (2 years ago)
Author:
chronos
Message:
  • Modified: More preparation for future Previous and Next buttons in Contact window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UContact.pas

    r76 r77  
    119119  TContact = class
    120120  private
     121    FModified: Boolean;
     122    FOnModify: TNotifyEvent;
    121123    function GetField(Index: TContactFieldIndex): string;
    122124    procedure SetField(Index: TContactFieldIndex; AValue: string);
     125    procedure SetModified(AValue: Boolean);
     126    procedure DoOnModify;
    123127  public
    124128    Properties: TContactProperties;
     
    137141    procedure LoadFromFile(FileName: string);
    138142    property Fields[Index: TContactFieldIndex]: string read GetField write SetField;
    139   end;
     143    property Modified: Boolean read FModified write SetModified;
     144    property OnModify: TNotifyEvent read FOnModify write FOnModify;
     145  end;
     146
     147  TGetContactEvent = function (Contact: TContact): TContact of object;
    140148
    141149  { TContacts }
     
    850858      end;
    851859    end;
     860    Modified := True;
    852861  end else raise Exception.Create(SFieldIndexNotDefined);
     862end;
     863
     864procedure TContact.SetModified(AValue: Boolean);
     865begin
     866  if FModified = AValue then Exit;
     867  FModified := AValue;
     868  DoOnModify;
     869end;
     870
     871procedure TContact.DoOnModify;
     872begin
     873  if Assigned(FOnModify) then FOnModify(Self);
    853874end;
    854875
     
    903924begin
    904925  Properties.Assign(Source.Properties);
     926  FModified := Source.FModified;
    905927end;
    906928
Note: See TracChangeset for help on using the changeset viewer.