Ignore:
Timestamp:
Dec 2, 2021, 2:13:03 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: List of contacts may not be reloaded on file open.
  • Modified: Preparation for previous/next contact actions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormContacts.pas

    r42 r43  
    5151    procedure FilterList(List: TFPGObjectList<TObject>);
    5252    procedure SetContacts(AValue: TContacts);
     53    procedure FormContactPrevious(Sender: TObject);
     54    procedure FormContactNext(Sender: TObject);
    5355  public
    5456    property Contacts: TContacts read FContacts write SetContacts;
     
    183185end;
    184186
     187procedure TFormContacts.FormContactPrevious(Sender: TObject);
     188var
     189  I: Integer;
     190begin
     191  I := ListViewSort1.List.IndexOf(TFormContact(Sender).Contact);
     192  if (I <> -1) and (I > 0) then
     193    TFormContact(Sender).Contact := TContact(ListViewSort1.List[I - 1]);
     194end;
     195
     196procedure TFormContacts.FormContactNext(Sender: TObject);
     197var
     198  I: Integer;
     199begin
     200  I := ListViewSort1.List.IndexOf(TFormContact(Sender).Contact);
     201  if (I <> -1) and (I < ListViewSort1.List.Count - 1) then
     202    TFormContact(Sender).Contact := TContact(ListViewSort1.List[I + 1]);
     203end;
     204
    185205procedure TFormContacts.FormShow(Sender: TObject);
    186206begin
     
    204224      Contact.Parent := Contacts.ContactsFile;
    205225      FormContact.Contact := Contact;
     226      FormContact.OnPrevious := FormContactPrevious;
     227      FormContact.OnNext := FormContactNext;
    206228      if FormContact.ShowModal = mrOK then begin
    207229        Contacts.Add(Contact);
     
    230252    Contact.Assign(TContact(ListView1.Selected.Data));
    231253    FormContact.Contact := Contact;
     254    FormContact.OnPrevious := FormContactPrevious;
     255    FormContact.OnNext := FormContactNext;
    232256    try
    233257      if FormContact.ShowModal = mrOK then begin
Note: See TracChangeset for help on using the changeset viewer.